24 lines
761 B
Nginx Configuration File
24 lines
761 B
Nginx Configuration File
# Serves the static site and reverse-proxies /api/* to the backend
|
|
# container — the browser only ever sees ONE origin (this one), so the
|
|
# calculator/contact-form fetch() calls in index.html can use plain
|
|
# relative paths with no CORS setup needed, and the backend's Python
|
|
# source is never reachable as a static file.
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
location /api/ {
|
|
proxy_pass http://backend:5000/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;
|
|
}
|
|
|
|
location / {
|
|
try_files $uri $uri/ =404;
|
|
}
|
|
}
|