A subrequest in Workers follows redirects by default and this is the desired behaviour for our use case.
However, the remote server may send the redirect with a cookie and only if the redirect is followed with the cookie does the remote server responds with 200. Else (no cookie), the remote server sends a 403.
This behaviour by the remote server is probably intended to disallow non-browser clients or something.
My question: is there a way to follow subrequest redirects with cookies?
Would this do the trick:
- Do the subrequest fetch with
redirect: manualso not to follow redirects
response.redirected, get the cookies from the response headers and put these in the next request’s headers
If yes: is there an easier way?