-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
48 lines (40 loc) · 1.46 KB
/
nginx.conf
File metadata and controls
48 lines (40 loc) · 1.46 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
server {
listen 80;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
add_header X-XSS-Protection "1; mode=block";
# Backend Django
location /api/ {
proxy_pass http://localhost:8000/api/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# # Turn off CORS header protection
# add_header Access-Control-Allow-Origin * always;
# add_header Access-Control-Allow-Methods "GET, POST, OPTIONS, PUT, DELETE" always;
# add_header Access-Control-Allow-Headers "Authorization, Content-Type" always;
# add_header Access-Control-Allow-Credentials true always;
# if ($request_method = OPTIONS ) {
# add_header Content-Length 0;
# add_header Content-Type text/plain;
# return 204;
# }
}
# Backend api static files
location /apistatic/ {
alias /workout_challenge/src-backend/static/; # Update this path to match your STATIC_ROOT
expires 5d;
add_header Cache-Control "public, no-transform";
}
# React frontend
location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri /index.html;
}
# Catch all for any unmatched routes
location @rewrites {
rewrite ^(.+)$ /index.html last;
}
}