Files
gitrusprusandCursor 10e7d65a00 Fix production auth by proxying /api to backend in remote builds.
Remote frontend nginx now forwards API requests to Django so login and registration work when the host proxy only routes to port 8080.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 09:33:54 +03:00

33 lines
887 B
Plaintext

server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
gzip on;
gzip_types text/css application/javascript application/json image/svg+xml;
# API → Django backend (контейнер backend в docker-compose)
location /api/ {
proxy_pass http://backend:8000/api/;
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;
proxy_connect_timeout 10s;
proxy_read_timeout 120s;
}
location / {
try_files $uri $uri/ /index.html;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ {
expires 7d;
add_header Cache-Control "public, immutable";
try_files $uri =404;
}
}