-
Notifications
You must be signed in to change notification settings - Fork 6
/
nginx.conf
29 lines (23 loc) · 1.15 KB
/
nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Flask backend is listening on port 6000 on host called yaptide_flask
upstream backend_flask {
server yaptide_flask:6000;
}
# main proxy server listening on port 5000 for plain HTTP and 8443 for HTTPS
server {
listen 5000;
listen 8443 ssl;
ssl_certificate /etc/nginx/conf.d/server.crt;
ssl_certificate_key /etc/nginx/conf.d/server.key;
# set CORS policy for all requests including preflighted ones (credentials are allowed by default)
location / {
proxy_pass http://backend_flask; # pass requests for dynamic content to Flask app
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
add_header 'Access-Control-Allow-Origin' '$http_origin' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, OPTIONS, DELETE' always;
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
client_max_body_size 100M;
}
}