dev-tunnels
dev-tunnels copied to clipboard
Devtunnel rewrites `localhost` location headers
trafficstars
Summary
When a server behind devtunnel sends an HTTP redirect to http://localhost:3000/some-url, devtunnel rewrites the Location header to something like:
Location: https://mytunnel.devtunnels.ms:3000/some-url
This breaks the redirect if port 3000 is not forwarded.
In my express server (which is being port forwarded) I am calling res.redirect('http://localhost:3000/some-url') but in the browser the location header is being rewritten as described above.
Steps to Reproduce
-
Start a devtunnel on a port other than 3000.
-
Serve a backend on that port that does:
res.redirect('http://localhost:3000/some-url'); -
Visit the devtunnel URL and trigger the redirect.
-
The browser is redirected to
https://<your-tunnel>:3000/some-urland fails to load.
Expected Behavior
Redirects to localhost should remain unchanged