docs: send Access-Control-Allow-Origin on every docs response - #375
Merged
Merged
Conversation
GitHub Pages sent "Access-Control-Allow-Origin: *" on every response; Cloudflare does not by default. Add a _headers file, shipped to the site root by html_extra_path, so tools on other sites can still read the docs' files (objects.inv, images, JSON) from a browser. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015fagcMeo1LmLG2Dg3NybmQ
thomaspinder
enabled auto-merge
October 1, 2026 07:00
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
GitHub Pages sent
Access-Control-Allow-Origin: *on every response. Cloudflare does not send it by default, so since the move to Cloudflare (#374) a browser blocks JavaScript on another site from reading the docs' files, for example a web tool that loadsobjects.inv. Nobody would report this kind of failure, because the error only shows in their own browser console.Solution
Add
docs/_headers, which Cloudflare's static assets read, and ship it to the site root next to_redirectsthroughhtml_extra_path. It setsAccess-Control-Allow-Origin: *on every path, as GitHub Pages did.Verification
_redirectsand_headersto the output root.wrangler dev(4.145.0) with this repo'sdocs/wrangler.jsoncand the current production build returnsaccess-control-allow-origin: *on pages, directory URLs,objects.inv, static files and 404s._headersitself is not served (404), and the_redirectsrules still parse.curl -sI https://impulso.quantclimate.com/objects.inv | grep -i access-control.🤖 Generated with Claude Code
https://claude.ai/code/session_015fagcMeo1LmLG2Dg3NybmQ