Skip to content

Add a test for preloading fetch resources when fetch() has headers specified #51217

Open
@xPaw

Description

@xPaw

I just ran into this issue myself where Firefox was not consuming a preload for fetch because the fetch() call was specifying custom headers. The specification does not mention that headers need to be matched, and Chrome removed preloaded resources by headers.

A simple repro would be:

<link rel="preload" href="test.json" as="fetch" crossorigin="anonymous">
fetch( 'test.json', {
	headers: {
		Accept: 'application/json', // Firefox disregards this header when consuming a preload
		'X-Requested-With': 'XMLHttpRequest', // but not this one
	}
} );

Refs:
https://issues.chromium.org/issues/40685467#comment21
https://bugzilla.mozilla.org/show_bug.cgi?id=1854292

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions