Skip to content

Fix Turnstile CORS preflight breaking session mint - #465

Merged
xenodus merged 2 commits into
masterfrom
cursor/turnstile-cors-query-fix-210a
Sep 10, 2026
Merged

xenodus merged 2 commits into
masterfrom
cursor/turnstile-cors-query-fix-210a

Conversation

@xenodus

@xenodus xenodus commented Sep 10, 2026

Copy link
Copy Markdown
Owner

Root cause

  1. CORS preflight: X-Turnstile-Token triggered a browser preflight that API Gateway does not allow → session mint failed (Failed to fetch → "Unable to connect").
  2. Deep-link search timing: Auto-search for ?s= URLs (trending links) only runs after sessionBootstrapped. With Turnstile + failed session mint, search never started. Init effect also set hasInitializedRef before checking maintenance mode, which could skip the landing search permanently.

Fix

  • Send Turnstile token as ?turnstileToken= query param (no custom-header preflight).
  • Refactor landing search to run once session bootstrap completes; retry if maintenance mode was blocking.

Deploy

Merge and deploy Lambda + frontend. No API Gateway change.

Testing

  • make test
  • After deploy: click a trending pill → page loads with ?s= → search runs automatically
Open in Web Open in Cursor 

cursoragent and others added 2 commits September 10, 2026 17:10
Send turnstileToken as a GET query param instead of X-Turnstile-Token.
API Gateway OPTIONS does not allow the custom header, so browsers blocked
session mint with Failed to fetch (Unable to connect error in the UI).

Co-authored-by: xenodus <xenodus@gmail.com>
Wait for Turnstile/session bootstrap before auto-searching ?s= URLs
(trending links). Do not mark landing search handled until bootstrap
completes; retry when maintenance mode clears.

Co-authored-by: xenodus <xenodus@gmail.com>
@xenodus
xenodus merged commit ad576b6 into master Sep 10, 2026
3 checks passed
@xenodus
xenodus deleted the cursor/turnstile-cors-query-fix-210a branch September 10, 2026 17:12
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.

2 participants