Skip to content

Fix Notion login prompt for custom domain users#72

Merged
shigahi merged 1 commit intomasterfrom
fix/slug-rewriting-for-notion-site
Mar 10, 2026
Merged

Fix Notion login prompt for custom domain users#72
shigahi merged 1 commit intomasterfrom
fix/slug-rewriting-for-notion-site

Conversation

@shigahi
Copy link
Collaborator

@shigahi shigahi commented Mar 10, 2026

Summary

  • Use clean PAGE_FETCH_HEADERS instead of forwarding request.headers when fetching page content from Notion
  • Previously, the original request headers (including Host: <custom-domain>) were forwarded to Notion, causing it to return a login page instead of public content for *.notion.site users
  • Applies to slug page fetches, non-slug page fetches, and custom 404 page fetches
  • Matches the pattern already used for API endpoint fetches (/api/*)

Fixes #55

Test plan

  • Verify slug pages load correctly without login prompt for *.notion.site users
  • Verify non-slug (direct page ID) pages still load correctly
  • Verify custom 404 pages still load correctly
  • Verify API calls (/api/*) are unaffected (already using clean headers)
  • Build succeeds (npm run build)

Previously, page fetches forwarded the original request.headers
(including Host header from the custom domain) to Notion. This
caused Notion to return a login page instead of public content
for *.notion.site users.

Use explicit PAGE_FETCH_HEADERS with standard user-agent, accept,
and accept-language headers, matching the pattern already used
for API endpoint fetches.

Fixes #55

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@shigahi shigahi merged commit 55e8635 into master Mar 10, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slug not working

1 participant