fix: relay requests to / with x-relay-target instead of showing index
When a GET request hits / with an x-relay-target header, it should relay the request — not display the index page. Fixed in all three entry points (src/index.ts, api/relay.ts, src/worker.ts). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
a67f9283e3
commit
3f96d8a6e7
+8
-2
@@ -362,10 +362,16 @@ export default {
|
||||
async fetch(req: Request): Promise<Response> {
|
||||
const url = new URL(req.url);
|
||||
|
||||
// Static routes
|
||||
// Static routes — show index only when no relay target is requested
|
||||
if (url.pathname === "/health") return handleHealth();
|
||||
if (url.pathname === "/docs") return handleDocs();
|
||||
if (url.pathname === "/" && req.method === "GET") return handleIndex();
|
||||
if (
|
||||
url.pathname === "/" &&
|
||||
req.method === "GET" &&
|
||||
!req.headers.get("x-relay-target")
|
||||
) {
|
||||
return handleIndex();
|
||||
}
|
||||
|
||||
// WebSocket upgrade — not supported in Vercel Functions
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user