diff --git a/packages/kit/src/runtime/server/respond.js b/packages/kit/src/runtime/server/respond.js index 429d523c3715..7e1d1c490696 100644 --- a/packages/kit/src/runtime/server/respond.js +++ b/packages/kit/src/runtime/server/respond.js @@ -114,8 +114,11 @@ export async function respond(request, options, manifest, state) { let resolved_path; try { - // reroute could alter the given URL, so we pass a copy - resolved_path = options.hooks.reroute({ url: new URL(url) }) ?? url.pathname; + // reroute could alter the given data, so we pass copies + resolved_path = options.hooks.reroute({ + url: new URL(url), + headers: new Headers(request.headers), + }) ?? url.pathname; } catch { return text('Internal Server Error', { status: 500