Headers set during fetch() invalidate matching preloaded resource
Categories
(Core :: DOM: Networking, defect, P3)
Tracking
()
People
(Reporter: austin.donisan, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: [necko-triaged])
Attachments
(4 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/117.0
Steps to reproduce:
Preload a url using the Link tag. Request the url with fetch(), but including a custom header. Attached is a simple test case.
Actual results:
The preloaded resource is discarded and a 2nd request is made with the header specified in fetch().
Expected results:
The preloaded response should be returned by fetch() since headers aren't part of the matching algorithm for preloaded resources.
https://html.spec.whatwg.org/multipage/links.html#link-type-preload
Comment 1•2 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::DOM: Networking' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
| Reporter | ||
Comment 2•2 years ago
|
||
fetch() doesn't work for local urls, so I hosted the test case to make this easier to verify:
Thanks for the report, can you submit some http logs for us to review?
You can use about:logging with the networking preset and log to file and upload here or email to necko@mozilla.com.
Thanks!
| Reporter | ||
Comment 4•2 years ago
|
||
| Reporter | ||
Comment 5•2 years ago
|
||
| Reporter | ||
Comment 6•2 years ago
|
||
Updated•2 years ago
|
Updated•2 years ago
|
| Reporter | ||
Comment 7•2 years ago
|
||
This bug also happens to requests made with XMLHttpRequest, not just with fetch.
I just ran into this issue where Firefox was not consuming a preload because I was setting X-Requested-With header on the fetch() request.
Firefox seems to ignore Accept header when matching a preload.
The HTML spec does not mention that headers need to be matched to consume a preload, and Chrome fixed this in 2022: https://issues.chromium.org/issues/40685467#comment21
Description
•