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

Expose the request's `mode' value #5

Closed
arturjanc opened this issue Oct 24, 2018 · 2 comments
Closed

Expose the request's `mode' value #5

arturjanc opened this issue Oct 24, 2018 · 2 comments

Comments

@arturjanc
Copy link
Contributor

The request mode has five different values: same-origin, cors, no-cors, navigate, or websocket. Including its value in Sec-Metadata would have a few benefits:

  • It would allow distinguishing navigation requests from subresource requests without checking destination for document and nested-document (checking for mode=navigate seems easier for developers).
  • It more clearly identifies CORS requests (which the server can generally exempt from Sec-Metadata checks because there already must exist logic that checks the origin and sets the right ACA* headers). Currently these requests can be identified by looking for destination="" and the presence of an Origin header, which is somewhat clunky.
  • It's likely more stable than the destination value. If developers write server-side checks based on a complete list of known values (which is a bad idea overall, but would be possible), then checking the mode could be less error-prone (e.g. if mode == "no-cors" && site != "same-origin": #reject).

Overall, it seems similar to the original idea of the target value (with the possible values of subresource, top-level or nested) but doesn't require introducing a new concept.

@mikewest

@arturjanc
Copy link
Contributor Author

Note that we might still need the nested-document value in destination to distinguish between top-level and nested navigations (or we could expose this in another way).

@mikewest
Copy link
Member

  1. Sounds fine. Willing to write a patch?
  2. As you note, we still need a mechanism to distinguish nestedness from non-nestedness. I'll go poke Consider splitting document into document and nested-document. whatwg/fetch#755.
  3. As of 279d75c, destination="" is destination=empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants