-
Notifications
You must be signed in to change notification settings - Fork 349
301/302/303 Redirect does not preserve headers #1711
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
Comments
Looking closer, is the issue a misinterpretation of
and not all headers. |
Yes, we strip a set of headers related to the request body. But not all headers. That's very much intentional as the request body isn't forwarded either in these cases (all of these go to |
Thanks! It was acknowledged as an implementation bug, so no issue with the spec. Still curious about the POST special case for 301 and 302s; is that just for legacy reasons? |
Browsers convert POST to GET for those and have done so forever, yes. It's allowed by the HTTP RFC and it's why we have 307 and 308 now (they don't do that). |
Uh oh!
There was an error while loading. Please reload this page.
What is the issue with the Fetch Standard?
The Bun JS runtime (https://github.com/oven-sh/bun) has recently updated their fetch implementation to match this spec. This has broken my client code due to the removal of headers sent on the original request from the subsequent redirected request.
See the issue I logged against bun here: oven-sh/bun#6053.
They're pointing to this portion of the spec: https://fetch.spec.whatwg.org/#http-redirect-fetch, in particular
#12
which states:Is this desired/expected behavior? If so, could you please explain why? Why would POSTs be singled out for 301s and 302s, and why would this not be the case for 303s?
My specific relevant case is a PUT, not a POST, but that's not necessarily a hard requirement if there's a way around this. How would I go about implementing an API that would have the semantics of a PUT/POST that redirects to a GET if I need headers passed to the resulting GET?
The text was updated successfully, but these errors were encountered: