1- worker_processes 4;
1+ server {
2+ listen 0.0.0.0:8081 ;
3+ root /app;
24
3- events {
4- worker_connections 1024 ;
5- }
5+ index index .html;
66
7- http {
8- server {
9- listen 80 ;
10- root /usr/share/nginx/html/OS2IoT-frontend;
11- include /etc/nginx/mime.types ;
12-
13- location / {
14- if ( $request_method = 'OPTIONS' ) {
15- add_header 'Access-Control-Allow-Origin' '*' ;
16- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' ;
17- #
18- # Custom headers and headers various browsers *should* be OK with but aren't
19- #
20- add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' ;
21- #
22- # Tell client that this pre-flight info is valid for 20 days
23- #
24- add_header 'Access-Control-Max-Age' 1728000 ;
25- add_header 'Content-Type' 'text/plain; charset=utf-8' ;
26- add_header 'Content-Length' 0;
27- return 204 ;
28- }
29- if ( $request_method = 'POST' ) {
30- add_header 'Access-Control-Allow-Origin' '*' ;
31- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' ;
32- add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' ;
33- add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' ;
34- }
35- if ( $request_method = 'GET' ) {
36- add_header 'Access-Control-Allow-Origin' '*' ;
37- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' ;
38- add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' ;
39- add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' ;
40- }
41- try_files $uri /index .html;
42- }
7+ location / {
8+ #if ($request_method = 'OPTIONS') {
9+ # add_header 'Access-Control-Allow-Origin' '*' always;
10+ # add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
11+ # #
12+ # # Custom headers and headers various browsers *should* be OK with but aren't
13+ # #
14+ # add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
15+ # #
16+ # # Tell client that this pre-flight info is valid for 20 days
17+ # #
18+ # add_header 'Access-Control-Max-Age' 1728000 always;
19+ # add_header 'Content-Type' 'text/plain; charset=utf-8' always;
20+ # add_header 'Content-Length' 0 always;
21+ # return 204;
22+ #}
23+ #if ($request_method = 'POST') {
24+ # add_header 'Access-Control-Allow-Origin' '*' always;
25+ # add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
26+ # add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
27+ # add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
28+ #}
29+ #if ($request_method = 'GET') {
30+ # add_header 'Access-Control-Allow-Origin' '*' always;
31+ # add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
32+ # add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
33+ # add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
34+ #}
35+ try_files $uri $uri / /index .html;
4336 }
44- }
37+ }
0 commit comments