mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-12 20:56:19 +00:00
forward headers from server component and make trust_proxy config a number
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { cookies } from "next/headers";
|
||||
import { cookies, headers } from "next/headers";
|
||||
import { pullEnv } from "../pullEnv";
|
||||
|
||||
export async function authCookieHeader() {
|
||||
@@ -7,9 +7,16 @@ export async function authCookieHeader() {
|
||||
const allCookies = await cookies();
|
||||
const cookieName = env.server.sessionCookieName;
|
||||
const sessionId = allCookies.get(cookieName)?.value ?? null;
|
||||
|
||||
// all other headers
|
||||
// this is needed to pass through x-forwarded-for, x-forwarded-proto, etc.
|
||||
const otherHeaders = await headers();
|
||||
const otherHeadersObject = Object.fromEntries(otherHeaders.entries());
|
||||
|
||||
return {
|
||||
headers: {
|
||||
Cookie: `${cookieName}=${sessionId}`,
|
||||
...otherHeadersObject
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user