|
| 1 | +# This file is intended to overwrite the default bonus config file at |
| 2 | +# /etc/nginx/conf.d/default.conf |
| 3 | + |
| 4 | +server { |
| 5 | + listen 9000; |
| 6 | + location / { |
| 7 | + root /opt/appdata; |
| 8 | + autoindex on; |
| 9 | + autoindex_format html; |
| 10 | + |
| 11 | + # CORS stuff adapted from https://enable-cors.org/server_nginx.html |
| 12 | + if ($request_method = 'OPTIONS') { |
| 13 | + add_header 'Access-Control-Allow-Origin' 'https://urbanonline.naturalcapitalproject.org' always; |
| 14 | + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; |
| 15 | + # |
| 16 | + # Custom headers and headers various browsers *should* be OK with but aren't |
| 17 | + # |
| 18 | + add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; |
| 19 | + # |
| 20 | + # Tell client that this pre-flight info is valid for 20 days |
| 21 | + # |
| 22 | + add_header 'Access-Control-Max-Age' 1728000; |
| 23 | + add_header 'Content-Type' 'text/plain; charset=utf-8'; |
| 24 | + add_header 'Content-Length' 0; |
| 25 | + return 204; |
| 26 | + } |
| 27 | + if ($request_method = 'POST') { |
| 28 | + add_header 'Access-Control-Allow-Origin' 'https://urbanonline.naturalcapitalproject.org' always; |
| 29 | + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always; |
| 30 | + add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always; |
| 31 | + add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always; |
| 32 | + } |
| 33 | + if ($request_method = 'GET') { |
| 34 | + add_header 'Access-Control-Allow-Origin' 'https://urbanonline.naturalcapitalproject.org' always; |
| 35 | + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always; |
| 36 | + add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always; |
| 37 | + add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always; |
| 38 | + } |
| 39 | + } |
| 40 | +} |
0 commit comments