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

Send Sec-Purpose: prefetch header for prefetch requests #1576

Merged
merged 8 commits into from
Jan 17, 2023

Conversation

noamr
Copy link
Contributor

@noamr noamr commented Dec 19, 2022

Send Sec-Purpose: prefetch for prefetch requests

The purpose headers allows servers to discern between regular requests
and "resource hints" - requests that are only meant to populate
caches.

This replaces the existing Purpose and x-moz: prefetch headers.

Closes w3c/webappsec-fetch-metadata#84
Closes w3c/resource-hints#74
Part of whatwg/html#8111

(See WHATWG Working Mode: Changes for more details.)


Preview | Diff

@noamr noamr changed the title Sec purpose Send Sec-Purpose: prefetch for prefetch requests Dec 19, 2022
@noamr noamr changed the title Send Sec-Purpose: prefetch for prefetch requests Send Sec-Purpose: prefetch header for prefetch requests Jan 4, 2023
@mnot
Copy link
Member

mnot commented Jan 4, 2023

If this lands, please don't forget to register the header.

@annevk
Copy link
Member

annevk commented Jan 5, 2023

That's a good point. Let's define this header then in its own section in HTTP extensions?

Also, we should probably define it as a structured header given that its new and use https://fetch.spec.whatwg.org/#concept-header-list-set-structured-header to set it.

@annevk annevk added topic: html addition/proposal New features or enhancements labels Jan 5, 2023
@noamr
Copy link
Contributor Author

noamr commented Jan 7, 2023

That's a good point. Let's define this header then in its own section in HTTP extensions?

Also, we should probably define it as a structured header given that its new and use https://fetch.spec.whatwg.org/#concept-header-list-set-structured-header to set it.

Done, hope this is right :)

The purpose headers allows servers to discern between regular requests
and "resource hints" - requests that are only meant to populate
caches.

This replaces the existing `Purpose` and `x-moz: prefetch` headers.

Closes w3c/webappsec-fetch-metadata#84
Part of whatwg/html#8111
@noamr
Copy link
Contributor Author

noamr commented Jan 11, 2023

@annevk all the checkboxes for this and for whatwg/html#8111 are ticked! Anything missing?

@noamr noamr mentioned this pull request Jan 13, 2023
3 tasks
fetch.bs Outdated Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
fetch.bs Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed some more commits. This looks good now. (Once the HTML PR is approved I will merge this.)

@annevk annevk added the do not merge yet Pull request must not be merged per rationale in comment label Jan 16, 2023
domenic pushed a commit to whatwg/html that referenced this pull request Jan 17, 2023
Prefetch is simply a fetch, which populates the HTTP cache, with no post-processing of the resource and with a special header Sec-Purpose: prefetch. (The latter is specified in whatwg/fetch#1576.)

Closes #5229.
Closes w3c/resource-hints#86.
Closes w3c/resource-hints#74.
Closes whatwg/fetch#1008.
@annevk annevk removed the do not merge yet Pull request must not be merged per rationale in comment label Jan 17, 2023
@annevk annevk merged commit c68b8e3 into whatwg:main Jan 17, 2023
@annevk
Copy link
Member

annevk commented Jan 17, 2023

Header registration: protocol-registries/http-fields#37.

@jeremyroman
Copy link
Contributor

The WebKit bug link looks incorrect; did you intend to link a different bug?

@annevk
Copy link
Member

annevk commented Jan 25, 2023

@jeremyroman thank you, I found a more suitable reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements topic: html
Development

Successfully merging this pull request may close these issues.

Define Sec-Purpose: Prefetch Sending a Purpose: prefetch header for prefetched resources
5 participants