Skip to content
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

3xx redirects - request formation #38

Closed
mnot opened this issue Sep 29, 2017 · 11 comments · Fixed by #424
Closed

3xx redirects - request formation #38

mnot opened this issue Sep 29, 2017 · 11 comments · Fixed by #424

Comments

@mnot
Copy link
Member

mnot commented Sep 29, 2017

see whatwg/fetch#609

@mnot mnot added the semantics label Sep 29, 2017
@reschke
Copy link
Contributor

reschke commented Oct 19, 2017

Well, the issue here is that the HTTP specs really say almost nothing about how the redirect happens (what header fields to include, for instance). If it did, then yes, this should be covered as well.

@mnot
Copy link
Member Author

mnot commented Jun 29, 2018

Yes, that's the focus.

Perhaps a starting point would be to talk about how the HTTP-defined headers and other protocol artefacts are copied / not copied / modified when following a redirect -- even if for some we have to say "depends upon the application", so applications know they have to cover this.

@mnot mnot mentioned this issue Jun 29, 2018
@mnot mnot changed the title More detail about 30x redirect request formation 3xx redirects - request formation Jun 29, 2018
@mnot mnot added the discuss label Jul 4, 2018
@mnot
Copy link
Member Author

mnot commented Jul 18, 2018

Discussed in Montreal; support for trying.

@mnot mnot removed the discuss label Jul 25, 2018
@mnot mnot self-assigned this Oct 10, 2018
@mnot mnot added the discuss label Nov 4, 2018
@royfielding
Copy link
Member

Seems reasonable, but where? At the top of 3xx section?

@mcmanus
Copy link

mcmanus commented Nov 6, 2018

in bkk: agreed to add more explanatory language; discussion contained references to the case of relative uris after redirects

@mnot mnot removed the discuss label Nov 12, 2018
@mnot
Copy link
Member Author

mnot commented Oct 1, 2019

For reference, the relevant part of fetch.

Waiting for #165 to sort out hop-by-hop headers.

@mnot mnot added the waiting label May 20, 2020
@mnot mnot removed the waiting label May 28, 2020
@mnot
Copy link
Member Author

mnot commented Jul 20, 2020

rough proposal:

When automatically following a redirected request, a User Agent SHOULD resend the original request message with the following modifications:

  1. Replace the target URI with the URI carried by the redirection responses' Location header field
  2. Remove connection-specific header fields [ref] (if any)
  3. Add new connection-specific header fields as appropriate to the connection the new request occurs upon
  4. Remove origin-specific header fields (if any), including (but not limited to) WWW-Authenticate, Cookie, 'Host'
  5. Add new origin-specific header fields as appropriate to the origin the new request is being sent to
  6. Remove validating header fields that were added by the implementation's cache (If-None-Match, If-Modified-Since) and replace them based upon the updated target URI, as appropriate
  7. Remove resource-specific header fields (if any), including (but not limited to) Referer, Origin
  8. Add new resource-specific header fields as appropriate to the resource the new request is being sent to
  9. Change the request method according to the redirecting status code's semantics, if applicable
  10. If the request method has been changed, remove content-specific header fields (if any), including (but not limited to) Content-Encoding, Content-Language, Content-Location, Content-Type, Content-Length, Digest, ETag, Last-Modified

@annevk
Copy link
Contributor

annevk commented Jul 20, 2020

Note whatwg/fetch#944 for some drawbacks.

@reschke
Copy link
Contributor

reschke commented Jul 21, 2020

0 -- Need to decide when to automatically redirect for a new 3xx. Triggered by presence of "location"?
1 -- And potentially resolved against the original URI.
10 -- The only method to ever change to is GET, right? (for 301, 302, 303)

@mnot
Copy link
Member Author

mnot commented Jul 24, 2020

0 - yes, but ultimately the decision is in the client's hands; i.e., we can't make any requirements here.

1 - yes

10 -- yes

@mnot
Copy link
Member Author

mnot commented Jul 29, 2020

@annevk I think we can address that with some general language to the effect that the overriding principle is: things automatically added by the implementation need to be removed and re-added as appropriate, whereas things added by the user (caller, developer, etc.) need to be preserved -- with potential exceptions for security purposes, such as Authorization.

Will start a PR.

mnot added a commit that referenced this issue Aug 3, 2020
reschke added a commit that referenced this issue Aug 6, 2020
@mnot mnot closed this as completed in #424 Aug 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

6 participants
@mnot @mcmanus @reschke @annevk @royfielding and others