Hi! I'm running into an issue with the Cloudflare Vite plugin where my OAuth callback route never reaches my Worker.
Setup:
Vite + React + TanStack Router
@cloudflare/vite-plugin
Hono API at /api/v1/*
Better Auth with Google OAuth
The Problem:
With this config in wrangler.jsonc:
jsonc"assets": {
"not_found_handling": "single-page-application"
}
When Google redirects back to /api/v1/auth/callback/google, the SPA fallback serves index.html instead of routing to my Worker. The callback request never hits my Hono server.
What I've tried:
Adding routing: { has_user_worker: true } to assets config (property not allowed)
Removing not_found_handling entirely - this fixes OAuth but breaks SPA routing for my frontend pages
Expected behavior:
/api/* routes should hit the Worker first, with SPA fallback only applying to non-API routes.
Creating a TanStack Router catch-all at src/routes/api/$.tsx that forces a page reload, but this forces app to reload infinitely.
Is there a proper way to configure the plugin so that /api/* routes always go to the Worker while keeping SPA fallback for everything else?