[READ-ONLY] Mirror of https://github.com/bombshell-dev/docs. bomb.sh/docs
0

Configure Feed

Select the types of activity you want to include in your feed.

ref(router): redirect to subdomain

Nate Moore (Apr 4, 2026, 10:22 PM EDT) 5724155e d6057bf3

+11 -5
+11 -5
router/src/index.ts
··· 1 1 export interface Env {} 2 2 3 + const HEADERS = { 4 + "Cross-Origin-Embedder-Policy": "require-corp", 5 + "Cross-Origin-Opener-Policy": "same-origin", 6 + "Cross-Origin-Resource-Policy": "cross-origin" 7 + } 8 + 3 9 export default { 4 10 async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> { 5 11 const url = new URL(request.url); ··· 7 13 if (url.pathname.startsWith("/docs")) { 8 14 const response = await fetch(new URL(url.pathname, "https://docs.bomb.sh/")); 9 15 const headers = new Headers(response.headers); 10 - headers.set("Cross-Origin-Embedder-Policy", "require-corp"); 11 - headers.set("Cross-Origin-Opener-Policy", "same-origin"); 12 - headers.set("Cross-Origin-Resource-Policy", "cross-origin"); 16 + for (const [name, value] of Object.entries(HEADERS)) { 17 + headers.set(name, value); 18 + } 13 19 return new Response(response.body, { 14 20 status: response.status, 15 21 statusText: response.statusText, ··· 17 23 }); 18 24 } 19 25 20 - return fetch(url); 26 + return Response.redirect(`https://bomb.sh/docs${url.pathname}`, 301); 21 27 }, 22 - } satisfies ExportedHandler<Env>; 28 + } satisfies ExportedHandler<Env>;