Skip to content

Commit

Permalink
Pass through cookies from DC_BASE
Browse files Browse the repository at this point in the history
  • Loading branch information
eyeseast committed Jan 30, 2024
1 parent 97213d5 commit 1ef78b9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/hooks.server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// https://kit.svelte.dev/docs/hooks#server-hooks
import { locale } from "svelte-i18n";
import { DC_BASE } from "./config/config.js";

/** @type {import('@sveltejs/kit').Handle} */
export async function handle({ event, resolve }) {
Expand All @@ -9,3 +10,12 @@ export async function handle({ event, resolve }) {
}
return resolve(event);
}

/** @type {import('@sveltejs/kit').HandleFetch} */
export async function handleFetch({ event, request, fetch }) {
if (request.url.startsWith(DC_BASE)) {
request.headers.set("cookie", event.request.headers.get("cookie"));
}

return fetch(request);
}

0 comments on commit 1ef78b9

Please sign in to comment.