I have a website that I am migrating the api from a separate host to a single combined site using assets/spa with the path for the api being under "/api/"
In the handler, I have a very simple router:
const requester = async (env, url, headers, request) => { try { if (url.pathname.startsWith("/public/")) { console.log("Public route in requester", request.method, url.toString()); return await env.PUBLIC_ROUTER.fetch(url, { ...request }); } return await env.API_ROUTER.fetch(url, { ...request, headers }); } catch (e) { console.log("Something went wrong", JSON.stringify(e)); } };
If I send a POST request to: "/api/public/turnstile/" I get the following in the logs for the frontend router:
`2025-12-29 17:24:22:875 GMT
POST /api/public/turnstile/
Public route in requester POST https://api-router.*****/public/turnstile/
2025-12-29 17:24:22:865 GMT
POST /api/public/turnstile/
POST https://app-v3.******/api/public/turnstile/`
Which is what I am expecting....
However... in the public endpoint:
`2025-12-29 17:24:22:896 GMT
GET /public/turnstile/
This is the main handler for public routes 23
2025-12-29 17:24:22:878 GMT
GET /public/turnstile/
GET https://api-router.*****/public/turnstile/`
Which is what I would get if this was a GET request!
Any ideas?