bubblesocket_nginx.conf 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. map $http_origin $cors_header{
  2. default "";
  3. include /etc/nginx/sites-whitelist/bubblesocket_whitelist.map;
  4. }
  5. server {
  6. listen 80;
  7. listen [::]:80;
  8. server_name ~^(?<protocol>.+)\.bubblesocket$ bubblesocket;
  9. access_log /var/log/nginx/bubblesocket.access.log;
  10. error_log /var/log/nginx/bubblesocket.error.log;
  11. location / {
  12. #include snippets/disable-cors.conf;
  13. if ($request_method = 'OPTIONS') {
  14. add_header 'Access-Control-Allow-Origin' '$cors_header';
  15. add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
  16. add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
  17. add_header 'Access-Control-Max-Age' 1728000;
  18. add_header 'Content-Type' 'text/plain; charset=utf-8';
  19. add_header 'Content-Length' 0;
  20. return 204;
  21. }
  22. proxy_pass http://127.0.0.1:29176/$protocol;
  23. proxy_hide_header Access-Control-Allow-Origin;
  24. add_header 'Access-Control-Allow-Origin' "$cors_header" always;
  25. add_header 'Access-Control-Allow-Credentials' 'true' always;
  26. add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
  27. add_header 'Access-Control-Allow-Headers' 'Origin, Content-Type, X-Auth-Token';
  28. proxy_http_version 1.1;
  29. proxy_set_header Upgrade $http_upgrade;
  30. proxy_set_header Connection "Upgrade";
  31. proxy_set_header Host $host;
  32. }
  33. }
  34. server {
  35. listen 443 ssl http2;
  36. listen [::]:443 ssl http2;
  37. include snippets/self-signed.conf;
  38. server_name ~^(?<protocol>.+)\.bubblesocket$ bubblesocket;
  39. access_log /var/log/nginx/bubblesocket.access.log;
  40. error_log /var/log/nginx/bubblesocket.error.log;
  41. location / {
  42. #include snippets/disable-cors.conf;
  43. if ($request_method = 'OPTIONS') {
  44. add_header 'Access-Control-Allow-Origin' '$cors_header';
  45. add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
  46. add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
  47. add_header 'Access-Control-Max-Age' 1728000;
  48. add_header 'Content-Type' 'text/plain; charset=utf-8';
  49. add_header 'Content-Length' 0;
  50. return 204;
  51. }
  52. proxy_pass http://127.0.0.1:29176/$protocol;
  53. proxy_hide_header Access-Control-Allow-Origin;
  54. add_header 'Access-Control-Allow-Origin' "$cors_header" always;
  55. add_header 'Access-Control-Allow-Credentials' 'true' always;
  56. add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
  57. add_header 'Access-Control-Allow-Headers' 'Origin, Content-Type, X-Auth-Token';
  58. proxy_http_version 1.1;
  59. proxy_set_header Upgrade $http_upgrade;
  60. proxy_set_header Connection "Upgrade";
  61. proxy_set_header Host $host;
  62. }
  63. }