302 Redirect headers are missing

Is it possible to extract the original headers from a worker fetch request to an end-point which returns a 302?

e.g.

const res = await fetch("http://localhost:3000/", {
"redirect": "manual"
})

res = {"body":{},"bodyUsed":false,"headers":{},"url":"http://localhost:3000/","redirected":false,"ok":false,"statusText":"Found","status":302}

If I run the same request via curl I get the original headers (e.g. location + set-cookie):

curl -v http://localhost:3000/
< HTTP/2 302
< cache-control: private
< location: https://www.google.com
< set-cookie: SIGNIN.REQUEST=1683699853; path=/; secure; HttpOnly
< access-control-expose-headers: Request-Context
< date: Tue, 09 May 2023 14:49:59 GMT
< content-length: 0

Is it possible to extract the original headers using Cloudflare workers (or any other Cloudflare service)?

The main problem is that the set-cookie header is lost.
Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
Was this page helpful?