damaged-thunder_nginx.conf 2.7 KB

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