Redirect goes to the wrong host, port or scheme (bad Location header)
The Location header sends the browser to an internal hostname, localhost, the wrong port or http instead of https.
redirected to localhostredirect goes to wrong port 8080Location header contains internal hostnameredirects to http instead of httpsredirect to internal IP Meaning
Apps behind proxies build absolute redirect URLs from the request they see (internal host, http, port 8080). Fix by passing Host/X-Forwarded-Host/X-Forwarded-Proto, setting the public base URL, or returning relative Location values.
Common causes
- App builds URLs from the internal host
- Proxy not forwarding Host/X-Forwarded-*
- Base URL/APP_URL misconfigured
- nginx
proxy_redirectmissing - Port 8080 leaking into the URL
⚡ Quick fix
- Set the app's public base URL (APP_URL, SITE_URL)
- Forward
HostandX-Forwarded-Proto - Use
proxy_redirector relative Location headers
Detailed fix by platform
Nginx
- nginx
proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_redirect http://backend:8080/ /;
How to diagnose
- Location — Internal host?
- Forwarded headers — Passed?
- Base URL — Correct?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in HTTP
Other ways to find it
Where this error sits
Origin: Network. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 18 Nov 2026