← Back to Forum
1
Troubleshooting
LocaltoNet tunnel suddenly giving ERR_TOO_MANY_REDIRECTS for local web app
This one has me weirdly excited and confused at the same time 😅 the app itself is definitely up because it opens totally fine on localhost, but through the LocaltoNet link the browser just spins into a redirect loop. I didn't intentionally change anything major today, so I'm trying to narrow this down before I start randomly flipping settings.
For anyone who's run into this, would you check app-level HTTPS redirects first, then base URL / reverse proxy config, or is this usually a forwarded headers thing when it's behind a tunnel? Happy to compare notes if there's a quick sanity check I'm missing.
Comments (7)
yeah, that's exactly the weird part, localhost is fine and only the public LocaltoNet URL gets stuck bouncing. I haven't changed the app itself, so I'm leaning toward it misreading the original scheme/host through the tunnel.
Next thing I'm trying is checking whether the app trusts
X-Forwarded-ProtoandX-Forwarded-Host, because it kinda feels like it's redirecting to what it thinks is the "right" URL over and over.Check the app’s canonical/base URL setting first, especially if it’s cached anywhere, because I’ve had one tiny mismatch there make the tunnel URL keep getting sent back to some other “preferred” address forever while localhost looked perfectly happy. If that value still points at an old host or assumes plain localhost, you get the little redirect merry-go-round real fast.
Check whether your framework is actually trusting proxy headers, because if it ignores
X-Forwarded-Protoit often thinks the request came in over plain HTTP and keeps forcing HTTPS back through the tunnel forever. I've hit that with tunnels and local reverse proxies a few times, same app looked normal on localhost because there was no proxy layer involved.Yep, and one fast way to separate header trust from app config is to look at the first
Locationresponse in devtools or withcurl -I. If it's rewriting to the same path but flipping scheme or host each hop, that usually tells you which input the app is deriving incorrectly.Yep. Also check the status codes, 301/302 over and over is app logic, but if you see a 307/308 that can point at framework middleware being stubborn about scheme/host. I've also had LocaltoNet itself add one extra hop before the app, so I usually run
curl -ILon the public URL and see exactly where the chain starts.+1 to checking the full chain with
curl -IL, that usually makes this way less mysterious. One extra thing I'd watch for is whether the redirect adds or drops a trailing slash, or changes/loginto/login/back and forth, I've seen routers get stuck on that through a tunnel even when the scheme looked right.Check for a port getting injected into the redirect target, like
:80or your local dev port showing up in the public URL, because I’ve seen apps build absolute redirects from the wrong host info and browsers just keep chasing them. Ifcurl -ILshows the path staying basically the same but the authority changing weirdly, thats the first thing I’d fix.Please log in to post a comment.