Something went wrong. Try again.
Monorepo for Tangled tangled.org
Something went wrong. Try again.
123456789101112131415161718192021export const noStore = (headers = new Headers()) => { headers.set("cache-control", "no-store"); return headers;};
export const redirectTo = (location: string) => { const headers = noStore(); headers.set("location", location); return new Response(null, { status: 302, headers });};
// reverse proxy terminates tls; url.protocol is http inside the workerexport const requestOrigin = (url: URL, headers: Headers) => { const forwarded = headers.get("x-forwarded-proto")?.split(",", 1)[0].trim().toLowerCase(); const protocol = forwarded === "http" || forwarded === "https" ? `${forwarded}:` : url.protocol; return `${protocol}//${url.host}`;};
export const isSecureRequest = (url: URL, headers: Headers) => requestOrigin(url, headers).startsWith("https://");