config nginx
This commit is contained in:
parent
11428ab3dd
commit
e31ac11515
|
@ -1,3 +1,8 @@
|
||||||
|
upstream backend {
|
||||||
|
server 100.66.170.15:8080
|
||||||
|
server 127.0.0.1:5218
|
||||||
|
server 172.18.10.8:8080
|
||||||
|
}
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
|
|
||||||
|
@ -18,4 +23,17 @@ server {
|
||||||
add_header Cache-Control "public";
|
add_header Cache-Control "public";
|
||||||
access_log off; # Optional: Don't log accesses for static files
|
access_log off; # Optional: Don't log accesses for static files
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location /api/ {
|
||||||
|
proxy_pass http://backend_api;
|
||||||
|
|
||||||
|
# CORS headers
|
||||||
|
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||||
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
|
||||||
|
add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization' always;
|
||||||
|
|
||||||
|
if ($request_method = OPTIONS) {
|
||||||
|
return 204;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user