nginx_roguelike.config 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. map $http_origin $roguelike_cors_header {
  2. default "";
  3. include /etc/nginx/sites-whitelist/roguelike.map;
  4. }
  5. server {
  6. listen 80;
  7. listen [::]:80;
  8. access_log /var/log/nginx/roguelike.access.log;
  9. error_log /var/log/nginx/roguelike.error.log;
  10. server_name roguelike roguelike.eyeofmidas.net;
  11. root /var/www/roguelike/wwwroot;
  12. #server_name roguelike.eyeofmidas.net;
  13. #return 302 https://$server_name$request_uri;
  14. location / {
  15. try_files $uri $uri/ =404;
  16. }
  17. }
  18. server {
  19. listen 443 ssl http2;
  20. listen [::]:443 ssl http2;
  21. include snippets/self-signed.conf;
  22. access_log /var/log/nginx/roguelike.access.log;
  23. error_log /var/log/nginx/roguelike.error.log;
  24. server_name roguelike roguelike.eyeofmidas.net;
  25. root /var/www/roguelike/wwwroot;
  26. location / {
  27. try_files $uri $uri/ =404;
  28. }
  29. }
  30. server {
  31. listen 8080;
  32. listen [::]:8080;
  33. access_log /var/log/nginx/roguelike.access.log;
  34. error_log /var/log/nginx/roguelike.error.log;
  35. server_name roguelike roguelike.eyeofmidas.net;
  36. #server_name roguelike.eyeofmidas.net;
  37. #return 302 https://$server_name$request_uri;
  38. location / {
  39. #include snippets/disable-cors.conf;
  40. if ($request_method = 'OPTIONS') {
  41. add_header X-debug-message 'origin: $http_origin cors: $roguelike_cors_header' always;
  42. add_header 'Access-Control-Allow-Origin' '$roguelike_cors_header';
  43. add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
  44. add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
  45. add_header 'Access-Control-Max-Age' 1728000;
  46. add_header 'Content-Type' 'text/plain; charset=utf-8';
  47. add_header 'Content-Length' 0;
  48. return 204;
  49. }
  50. proxy_pass http://127.0.0.1:5084;
  51. proxy_hide_header Access-Control-Allow-Origin;
  52. add_header 'Access-Control-Allow-Origin' "$roguelike_cors_header" always;
  53. add_header 'Access-Control-Allow-Credentials' 'true' always;
  54. add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
  55. add_header 'Access-Control-Allow-Headers' 'Origin, Content-Type, X-Auth-Token';
  56. }
  57. }
  58. server {
  59. listen 443 ssl http2;
  60. listen [::]:443 ssl http2;
  61. include snippets/self-signed.conf;
  62. access_log /var/log/nginx/roguelike.access.log;
  63. error_log /var/log/nginx/roguelike.error.log;
  64. server_name roguelike roguelike.eyeofmidas.net;
  65. location / {
  66. #include snippets/disable-cors.conf;
  67. if ($request_method = 'OPTIONS') {
  68. add_header 'Access-Control-Allow-Origin' '$roguelike_cors_header';
  69. add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
  70. add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
  71. add_header 'Access-Control-Max-Age' 1728000;
  72. add_header 'Content-Type' 'text/plain; charset=utf-8';
  73. add_header 'Content-Length' 0;
  74. return 204;
  75. }
  76. proxy_pass http://127.0.0.1:5084;
  77. proxy_hide_header Access-Control-Allow-Origin;
  78. add_header 'Access-Control-Allow-Origin' "$roguelike_cors_header" always;
  79. add_header 'Access-Control-Allow-Credentials' 'true' always;
  80. add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
  81. add_header 'Access-Control-Allow-Headers' 'Origin, Content-Type, X-Auth-Token';
  82. }
  83. }