Files
catalogue_frontend/nginx.conf

41 lines
1.4 KiB
Nginx Configuration File

events {}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Excel/CSV catalog uploads (see /api/upload/*) can exceed nginx's 1m default.
client_max_body_size 20m;
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript image/svg+xml;
server {
listen 80;
server_name localhost;
# Backend API, proxied to the FastAPI container on the same Docker
# network. proxy_pass uses a variable + Docker's embedded DNS
# (127.0.0.11) so the backend's address is re-resolved per request
# instead of cached once at nginx startup - otherwise nginx would
# keep hitting a stale IP after the backend container restarts.
resolver 127.0.0.11 valid=30s;
location /api/ {
set $backend_upstream "http://backend:8000";
proxy_pass $backend_upstream;
proxy_http_version 1.1;
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 / {
root /usr/share/nginx/html;
index index.html index.htm;
# This line forces Nginx to pass routing back to React Router
try_files $uri $uri/ /index.html;
}
}
}