nginx strips port from 307 redirect Location header on no-trailing-slash requests #107
Labels
No labels
accessibility
backlog
beta-feedback
bug
duplicate
enhancement
feature-request
help wanted
invalid
needs-design
needs-triage
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Circuit-Forge/kiwi#107
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
nginx forwards Host without port, so FastAPI 307 redirects resolve to port 80.
Steps to reproduce
curl -D - http://localhost:8515/api/v1/receipts
Location: http://localhost/api/v1/receipts/ (port 8515 missing)
Expected
Location: http://localhost:8515/api/v1/receipts/
Root cause
nginx.cloud.conf uses proxy_set_header Host $host which omits the port.
Affected paths
GET /api/v1/receipts, GET /api/v1/meal-plans, GET /api/v1/health
Impact
Low for production (frontend uses trailing slashes; Caddy is HTTPS). Affects direct API consumers and dev tooling.
Fix
Change to proxy_set_header Host $http_host in nginx.cloud.conf. $http_host includes the port when present in the client request.