Skip to content

Commit

Permalink
Send Sec-Purpose: prefetch for prefetch requests
Browse files Browse the repository at this point in the history
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
  • Loading branch information
noamr committed Dec 19, 2022
1 parent 326250f commit ef2d177
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fetch.bs
Original file line number Diff line number Diff line change
Expand Up @@ -5039,6 +5039,10 @@ steps. They return a <a for=/>response</a>.
<li><p><a abstract-op lt="append the Fetch metadata headers for a request">Append the Fetch metadata headers for <var>httpRequest</var></a>.
[[!FETCH-METADATA]]

<li><p>If <var>httpRequest</var>'s <a for=request>initiator</a> is "<code>prefetch</code>", then
<a for="header list">append</a> (`<code>Sec-Purpose</code>`, "<code>prefetch</code>") to
<var>httpRequest</var>'s <a for=request>header list</a>.

<li><p>If <var>httpRequest</var>'s <a for=request>header list</a>
<a for="header list">does not contain</a> `<code>User-Agent</code>`, then user agents should
<a for="header list">append</a> (`<code>User-Agent</code>`,
Expand Down

0 comments on commit ef2d177

Please sign in to comment.