Skip to content

Hotfix: /api/v1 is an app route, not marketing - #61

Merged
neuromechanist merged 1 commit into
mainfrom
feature/hotfix-api-v1-app-route
May 23, 2026
Merged

neuromechanist merged 1 commit into
mainfrom
feature/hotfix-api-v1-app-route

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Bug

After PR #60 (the same-origin proxy), /api/v1/* requests on app.nemar.org were being 301'd to ww2.nemar.org by the host-split middleware, because /api/v1 wasn't in APP_ROUTE_PREFIXES. The proxy was effectively unreachable from the app host.

Verified live: curl -sS -o /dev/null -w "%{http_code}" "https://app.nemar.org/api/v1/datasets?mine=true&limit=1" returns 301.

Fix

Add /api/v1 to APP_ROUTE_PREFIXES with a comment about WHY it has to be app-host-only (the cookie scope). Updated the isAppRoute test to cover representative paths.

Test plan

  • bun run typecheck — 0 errors
  • bun run test — 370/370 (+4 new app-route cases)
  • bun run lint — clean
  • After deploy: curl https://app.nemar.org/api/v1/datasets?mine=true returns 401 (proxy reaches backend, backend returns 401 because no cookie) — not 301.
  • After deploy + sign-in: dashboard "Delete draft" / "Request publication" / "Invite" buttons succeed.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying nemar-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: 45bcc97
Status:🚫  Deploy failed.

View logs

@neuromechanist
neuromechanist merged commit c3d200d into main May 23, 2026
1 check failed
@neuromechanist
neuromechanist deleted the feature/hotfix-api-v1-app-route branch June 21, 2026 22:50
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.

1 participant