Skip to content

fix(web): preserve workspace domains through redirects - #7442

Merged
ComputelessComputer merged 1 commit into
mainfrom
fix/workspace-share-redirects
Sep 7, 2026
Merged

fix(web): preserve workspace domains through redirects#7442
ComputelessComputer merged 1 commit into
mainfrom
fix/workspace-share-redirects

Conversation

@ComputelessComputer

@ComputelessComputer ComputelessComputer commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Netlify can return absolute redirect destinations using its origin hostname. Rewrite those destinations to the incoming workspace hostname so trailing-slash and auth redirects keep users on their workspace domain. Preserve external redirects and keep redirect following disabled so proxy credentials stay on the origin.

Validation: web typecheck, 317 web tests, formatting, and Wrangler dry-run passed. Tests cover absolute and relative origin redirects and an external auth destination. This only changes the Cloudflare Worker and its tests; the web application deployment is unchanged.


Note

Medium Risk
Changes redirect handling on the workspace proxy edge path; incorrect rewriting could break auth or trailing-slash flows, though scope is limited to the Cloudflare worker.

Overview
The Cloudflare workspace-share worker now rewrites redirect Location headers from the Netlify origin so users stay on their workspace hostname (e.g. fastrepl.anarlog.so) instead of being sent to anarlog.netlify.app.

After proxying to origin with redirect: manual, 3xx responses are inspected: if the resolved URL’s origin matches the app origin, only the host is swapped to the incoming request’s host; query strings, fragments, and relative paths are preserved. External redirects (e.g. Google OAuth) are passed through unchanged.

New tests cover absolute Netlify URLs, relative /auth/ paths, and an external auth URL.

Reviewed by Cursor Bugbot for commit 186d065. Bugbot is set up for automated code reviews on this repo. Configure here.

@netlify

netlify Bot commented Sep 7, 2026

Copy link
Copy Markdown

Deploy Preview for anarlog canceled.

Name Link
🔨 Latest commit 186d065
🔍 Latest deploy log https://app.netlify.com/projects/anarlog/deploys/6a9ed209e1077c00081ac228

@ComputelessComputer
ComputelessComputer changed the base branch from fix/workspace-share-proxy-host to main September 7, 2026 14:48
@ComputelessComputer
ComputelessComputer force-pushed the fix/workspace-share-redirects branch from 8413450 to 5d27f42 Compare September 7, 2026 15:02
Rewrite Netlify-origin redirect destinations to the workspace hostname while keeping external redirects and proxy credentials separate.
@ComputelessComputer
ComputelessComputer force-pushed the fix/workspace-share-redirects branch from 5d27f42 to 186d065 Compare September 7, 2026 15:02
@ComputelessComputer
ComputelessComputer merged commit 4d117a6 into main Sep 7, 2026
15 of 16 checks passed
@ComputelessComputer
ComputelessComputer deleted the fix/workspace-share-redirects branch September 7, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant