fix: use exact location match for /api to prevent 301 on POST

location /api/ caused nginx to 301-redirect POST /api -> /api/
Browsers follow 301 with GET, breaking JSON-RPC. Exact match
location = /api proxies directly without redirect.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-21 09:32:49 +02:00
parent 3e15defd0e
commit 14c41e1a54

View File

@@ -9,11 +9,14 @@ server {
}
# Proxy API calls to the backend service
location /api/ {
# 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 {
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;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Rewrite /{lang}/result/{id} to /{lang}/result/id/index.html