2026-04-21 08:19:24 +02:00
|
|
|
server {
|
|
|
|
|
listen 80;
|
|
|
|
|
root /usr/share/nginx/html;
|
|
|
|
|
index index.html;
|
|
|
|
|
|
|
|
|
|
# Redirect root to Spanish
|
|
|
|
|
location = / {
|
|
|
|
|
return 301 /es/;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Proxy API calls to the backend service
|
2026-04-21 09:32:49 +02:00
|
|
|
# Exact match on /api — avoids the 301 redirect nginx emits for
|
|
|
|
|
# location /api/ when the client posts to bare /api (POST→GET on 301)
|
|
|
|
|
location = /api {
|
2026-04-21 08:19:24 +02:00
|
|
|
proxy_pass http://backend:5000/;
|
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
2026-04-21 09:32:49 +02:00
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
2026-04-21 08:19:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Rewrite /{lang}/result/{id} to /{lang}/result/id/index.html
|
|
|
|
|
location ~ ^/([^/]+)/result/[^/]+/?$ {
|
|
|
|
|
set $lang $1;
|
|
|
|
|
try_files /$lang/result/id/index.html =404;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Rewrite /result/{id} to /es/result/id/index.html
|
|
|
|
|
location ~ ^/result/[^/]+/?$ {
|
|
|
|
|
try_files /es/result/id/index.html =404;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
location / {
|
|
|
|
|
try_files $uri $uri/ =404;
|
|
|
|
|
}
|
|
|
|
|
}
|