-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Open
Labels
Description
FAQ
- Yes, my issue is not about variability or throttling.
- Yes, my issue is not about a specific accessibility audit (file with axe-core instead).
- Yes, my issue is not answered by other FAQs.
URL
https://www.epa.ie/who-we-are/gaeilge/an-sceim-teanga/
What happened?
Some resources on the page are blocked due to a CORS error from allowed headers.
{
"method": "Network.loadingFailed",
"params": {
"requestId": "7416.49",
"timestamp": 721073.514311,
"type": "Font",
"errorText": "net::ERR_FAILED",
"canceled": false,
"corsErrorStatus": {
"corsError": "HeaderDisallowedByPreflightResponse",
"failedParameter": "x-hide-preview-toolbar"
}
},
"targetType": "page",
"sessionId": "B88FA97ACC7C3B86A5265831AEA4C3FE"
},
has been blocked by CORS policy: Request header field x-hide-preview-toolbar is not allowed by Access-Control-Allow-Headers in preflight response.
What did you expect?
Expected the header to only be added to my current page request rather than all subsequent requests.
What have you tried?
Patching:
if (headers) await session.sendCommand('Network.setExtraHTTPHeaders', { headers });
to:
if (headers) {
// Use the Fetch protocol to only add headers to the main document requests.
await session.sendCommand('Fetch.enable', {
patterns: [{urlPattern: '*', resourceType: 'Document', requestStage: 'Request'}],
});
session.on('Fetch.requestPaused', async event => {
await session.sendCommand('Fetch.continueRequest', {
requestId: event.requestId,
// Merge the extra headers with the existing headers and ensure value is a string.
headers: Object.entries({...event.request.headers, ...headers}).map(([name, value]) => ({
name,
value: String(value),
})),
});
});
}
How were you running Lighthouse?
node
Lighthouse Version
12.8.1
Chrome Version
139.0.7258.157
Node Version
22.18.0
OS
Windows
Relevant log output
leventefeher