-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simple 302 redirect makes the worker unusable #11
Comments
I think it's nice that the browser makes the redirect instead of it being done at server-side, like many other proxies - it gives you more control over the request that is being done. however I notice when a redirect happens to a relative path like this one: var proxy = 'https://test.cors.workers.dev/?'
var url = 'https://httpbin.org/cookies/set/key/value'
fetch(proxy + url) it will redirect to var proxy = 'https://test.cors.workers.dev/?'
var url = 'https://httpbin.org/cookies/set/key/value'
fetch(proxy + url, { follow: 'manual' }).then(res => {
// read the forbidden headers:
var headers = res.headers.get('cors-received-headers')
headers = new Headers(JSON.parse(headers))
console.log(headers.get('set-cookie'))
// handle the redirect:
var base = url
var location = new URL(res.headers.get('location'), base)
fetch(proxy + location)
}) but the response is a opaqueredirect and i can't read anything |
Same problem. I tried to download GitHub zipballs with my deployment of this CORS proxy: How do I handle the redirect manually so that I can make the redirected request with CORS proxy as well? Should I try |
|
if you have any solutions feel free to do a pull request after testing it. |
If server sets a 302 redirect rule to original links the script doesn't work. Try forexfactory.com as example.
Is there a workaround?
The text was updated successfully, but these errors were encountered: