Invalid Access-Control-Allow-Origin example in Workers _headers docs #22002
Labels
content:edit
Request for content edits
documentation
Documentation edits
product:workers
Related to Workers product
Existing documentation URL(s)
What changes are you suggesting?
The CORS example in the Workers Static Assets Headers documentation seems to be invalid according to the CORS specification.
Specifically, this example does not work as described:
According to the WHATWG Fetch specification,
Access-Control-Allow-Origin
only accepts:*
(all origins)null
Wildcards within origin values like
https://*-my-worker.my-subdomain.workers.dev
are not supported.Example of issue
Using the
_headers
example described in the documentation, when fetchinghttps://my-worker.my-subdomain.workers.dev/asset.png
with an originhttps://versionprefix-my-worker.my-subdomain.workers.dev
, the CORS request fails due to an mismatchingAccess-Control-Allow-Origin
:Request headers:
Response headers:
This causes CORS failure as the browser rejects this invalid
Access-Control-Allow-Origin
header value.Suggested action
Remove this invalid example from the documentation since it cannot work as described. Alternatively, give an updated example if there is some other workaround.
Additional information
No response
The text was updated successfully, but these errors were encountered: