From 72eb1b8b4b7e9f00693c622ba602ea9c49552329 Mon Sep 17 00:00:00 2001 From: Thomas Pinder Date: Thu, 1 Oct 2026 09:00:27 +0200 Subject: [PATCH] docs: send Access-Control-Allow-Origin on every docs response 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 Claude-Session: https://claude.ai/code/session_015fagcMeo1LmLG2Dg3NybmQ --- docs/_headers | 5 +++++ docs/conf.py | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 docs/_headers diff --git a/docs/_headers b/docs/_headers new file mode 100644 index 0000000..938cab4 --- /dev/null +++ b/docs/_headers @@ -0,0 +1,5 @@ +# Cloudflare static-asset headers, copied to the site root by html_extra_path. +# GitHub Pages sent this on every response. Without it, tools on other sites +# cannot read the docs' files (objects.inv, images, JSON) from a browser. +/* + Access-Control-Allow-Origin: * diff --git a/docs/conf.py b/docs/conf.py index 1e837ba..9b7f435 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -153,8 +153,9 @@ ogp_social_cards = {"enable": False} html_static_path = ["stylesheets"] html_css_files = ["extra.css"] -# Cloudflare serves the site; _redirects maps directory URLs to index.html. -html_extra_path = ["_redirects"] +# Cloudflare serves the site; _redirects maps directory URLs to index.html and +# _headers adds the CORS header that GitHub Pages used to send. +html_extra_path = ["_redirects", "_headers"] html_theme_options = { "accent_color": "crimson", # names the token family; stylesheets/extra.css re-tones the crimson scale to ledger oxblood "color_mode": "auto", # follow the reader's light/dark preference