rewriteLoopbackLocation
rewriteLoopbackLocation(
headers,devPort):void
Defined in: src/preview.ts:711
Rewrite an upstream redirect whose Location points back at the loopback dev server
(http://127.0.0.1:<devPort>/… or localhost:<devPort>) to a PATH-RELATIVE form, so
the browser resolves it against the preview origin (host.ts.net:<previewPort>) rather
than following an unreachable loopback URL. The redirect: “manual” proxy passes Location
through verbatim, so a dev server’s own absolute self-redirect (trailing-slash, base
path, post-login) would otherwise strand the browser. Already-relative Locations and
genuinely cross-origin redirects (OAuth providers, CDNs) are left untouched.
Parameters
Section titled “Parameters”headers
Section titled “headers”Headers
devPort
Section titled “devPort”number
Returns
Section titled “Returns”void