|
| 1 | +server { |
| 2 | + listen 8080; |
| 3 | + server_name localhost; |
| 4 | + root /usr/share/nginx/html; |
| 5 | + |
| 6 | + location / { |
| 7 | + index index.html index.htm; |
| 8 | + } |
| 9 | + |
| 10 | + location ~ \.(css|html)$ { |
| 11 | + expires epoch; |
| 12 | + } |
| 13 | + |
| 14 | + location ~ \.(eot|otf|ttf|woff|woff2)$ { |
| 15 | + if ($request_method = 'OPTIONS') { |
| 16 | + add_header 'Access-Control-Allow-Origin' '*'; |
| 17 | + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; |
| 18 | + # |
| 19 | + # Custom headers and headers various browsers *should* be OK with but aren't |
| 20 | + # |
| 21 | + add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; |
| 22 | + # |
| 23 | + # Tell client that this pre-flight info is valid for 20 days |
| 24 | + # |
| 25 | + add_header 'Access-Control-Max-Age' 1728000; |
| 26 | + add_header 'Content-Type' 'text/plain; charset=utf-8'; |
| 27 | + add_header 'Content-Length' 0; |
| 28 | + return 204; |
| 29 | + } |
| 30 | + if ($request_method = 'POST') { |
| 31 | + add_header 'Access-Control-Allow-Origin' '*'; |
| 32 | + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; |
| 33 | + add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; |
| 34 | + add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range'; |
| 35 | + } |
| 36 | + if ($request_method = 'GET') { |
| 37 | + add_header 'Access-Control-Allow-Origin' '*'; |
| 38 | + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; |
| 39 | + add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; |
| 40 | + add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range'; |
| 41 | + } |
| 42 | + } |
| 43 | + |
| 44 | + error_page 500 502 503 504 /50x.html; |
| 45 | + location = /50x.html { |
| 46 | + root /usr/share/nginx/html; |
| 47 | + } |
| 48 | + |
| 49 | + location /healthcheck { |
| 50 | + default_type 'text/plain'; |
| 51 | + return 200 'OK'; |
| 52 | + } |
| 53 | +} |
0 commit comments