Fix XHR domain rewriting for *.notion.site users#62
Merged
Conversation
The client-side XMLHttpRequest override was hardcoded to rewrite custom domain URLs to www.notion.so. For users whose Notion pages are hosted on *.notion.site domains, this caused API calls to fail, crashing the site. Use NOTION_SITE_DOMAIN instead. Fixes #55 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Open
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.
Summary
www.notion.soas the target domainNOTION_SITE_DOMAINso API calls are routed to the correct Notion backend (e.g.,philipb.notion.site)*.notion.sitedomainsRoot Cause
The XHR override in the generated Worker script rewrites URLs from the custom domain back to the Notion backend. It was hardcoded to
www.notion.so, but users with personal Notion workspaces use*.notion.sitedomains. API calls were sent to the wrong server, causing the site to fail to load.Related: #55
Test plan
*.notion.siteNotion URL and verify the XHR override uses the correct domainwww.notion.soNotion URL and verify backwards compatibilitynpm run buildsucceeds🤖 Generated with Claude Code