Skip to content

Make proxy follow redirects server-side instead of passing to the browser#3

Open
lxpollitt wants to merge 1 commit intolanceewing:masterfrom
lxpollitt:fix-proxy-redirect
Open

Make proxy follow redirects server-side instead of passing to the browser#3
lxpollitt wants to merge 1 commit intolanceewing:masterfrom
lxpollitt:fix-proxy-redirect

Conversation

@lxpollitt
Copy link
Copy Markdown

Fixes #2

Changes fetch(request) to fetch(request, { redirect: 'follow' }) so the Cloudflare Worker follows redirects server-side rather than passing them through to the browser.

See the linked issue for full diagnosis, a failing example, a working example, and a discussion of the bandwidth trade-off.

Tested locally using Wrangler — before the fix the proxy returns a 302 to the browser; after the fix it returns a 200 with the proxy's own CORS headers applied.

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.

?url= parameter fails when archive.org redirects to CDN node without CORS headers

1 participant