Compare commits

...

1 Commits

Author SHA1 Message Date
Owen
978ac8f53c Add logging 2026-02-24 20:51:27 -08:00

View File

@@ -2,31 +2,22 @@ import { headers } from "next/headers";
export async function authCookieHeader() { export async function authCookieHeader() {
const otherHeaders = await headers(); const otherHeaders = await headers();
const otherHeadersObject = Object.fromEntries(otherHeaders.entries()); const otherHeadersObject = Object.fromEntries(
Array.from(otherHeaders.entries()).map(([k, v]) => [k.toLowerCase(), v])
);
console.info(`Setting cookie... x-forwarded-for: ${otherHeadersObject["x-forwarded-for"]}`)
return { return {
headers: { headers: {
cookie: cookie: otherHeadersObject["cookie"],
otherHeadersObject["cookie"] || otherHeadersObject["Cookie"], host: otherHeadersObject["host"],
host: otherHeadersObject["host"] || otherHeadersObject["Host"], "user-agent": otherHeadersObject["user-agent"],
"user-agent": "x-forwarded-for": otherHeadersObject["x-forwarded-for"],
otherHeadersObject["user-agent"] || "x-forwarded-host": otherHeadersObject["x-forwarded-host"],
otherHeadersObject["User-Agent"], "x-forwarded-port": otherHeadersObject["x-forwarded-port"],
"x-forwarded-for": "x-forwarded-proto": otherHeadersObject["x-forwarded-proto"],
otherHeadersObject["x-forwarded-for"] || "x-real-ip": otherHeadersObject["x-real-ip"]
otherHeadersObject["X-Forwarded-For"],
"x-forwarded-host":
otherHeadersObject["fx-forwarded-host"] ||
otherHeadersObject["Fx-Forwarded-Host"],
"x-forwarded-port":
otherHeadersObject["x-forwarded-port"] ||
otherHeadersObject["X-Forwarded-Port"],
"x-forwarded-proto":
otherHeadersObject["x-forwarded-proto"] ||
otherHeadersObject["X-Forwarded-Proto"],
"x-real-ip":
otherHeadersObject["x-real-ip"] ||
otherHeadersObject["X-Real-IP"]
} }
}; };
} }