teetopia_nginx.conf 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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/teetopia.access.log;
  9. error_log /var/log/nginx/teetopia.error.log;
  10. server_name teetopia teetopia.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:38872;
  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. location /ws {
  35. proxy_pass http://127.0.0.1:38872;
  36. proxy_http_version 1.1;
  37. proxy_set_header Upgrade $http_upgrade;
  38. proxy_set_header Connection "Upgrade";
  39. proxy_set_header Host $host;
  40. }
  41. }
  42. server {
  43. listen 443 ssl http2;
  44. listen [::]:443 ssl http2;
  45. include snippets/self-signed.conf;
  46. access_log /var/log/nginx/teetopia.access.log;
  47. error_log /var/log/nginx/teetopia.error.log;
  48. server_name teetopia teetopia.eyeofmidas.net;
  49. location / {
  50. #include snippets/disable-cors.conf;
  51. if ($request_method = 'OPTIONS') {
  52. add_header 'Access-Control-Allow-Origin' '$cors_header';
  53. add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
  54. add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
  55. add_header 'Access-Control-Max-Age' 1728000;
  56. add_header 'Content-Type' 'text/plain; charset=utf-8';
  57. add_header 'Content-Length' 0;
  58. return 204;
  59. }
  60. proxy_pass http://127.0.0.1:38872;
  61. proxy_hide_header Access-Control-Allow-Origin;
  62. add_header 'Access-Control-Allow-Origin' "$cors_header" always;
  63. add_header 'Access-Control-Allow-Credentials' 'true' always;
  64. add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
  65. add_header 'Access-Control-Allow-Headers' 'Origin, Content-Type, X-Auth-Token';
  66. proxy_http_version 1.1;
  67. proxy_set_header Upgrade $http_upgrade;
  68. proxy_set_header Connection $http_connection;
  69. }
  70. location /ws {
  71. proxy_pass http://127.0.0.1:38872;
  72. proxy_http_version 1.1;
  73. proxy_set_header Upgrade $http_upgrade;
  74. proxy_set_header Connection "Upgrade";
  75. proxy_set_header Host $host;
  76. }
  77. }