Skip to content

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

Merged
annevk merged 8 commits into
whatwg:mainfrom
noamr:sec-purpose
Jan 17, 2023
Merged

annevk merged 8 commits into
whatwg:mainfrom
noamr:sec-purpose

Conversation

@noamr

@noamr noamr commented Dec 19, 2022 •

Copy link
Copy Markdown
Contributor

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
@noamr noamr mentioned this pull request Jan 4, 2023
3 tasks done
@mnot

mnot commented Jan 4, 2023

Copy link
Copy Markdown
Member

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

@annevk

annevk commented Jan 5, 2023

Copy link
Copy Markdown
Member

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

noamr commented Jan 7, 2023

Copy link
Copy Markdown
Contributor Author

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 :)

noamr added 4 commits January 11, 2023 15:36
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

noamr commented Jan 11, 2023

Copy link
Copy Markdown
Contributor Author

@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 done
Comment thread fetch.bs Resolved
Comment thread fetch.bs Resolved
Comment thread fetch.bs Resolved
Comment thread fetch.bs Resolved

@annevk annevk left a comment •

Copy link
Copy Markdown
Member

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

annevk commented Jan 17, 2023

Copy link
Copy Markdown
Member

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

@jeremyroman

Copy link
Copy Markdown
Contributor

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

@annevk

annevk commented Jan 25, 2023

Copy link
Copy Markdown
Member

@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