Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(cloud): clear session cookie that was created during incident (#10599)

Marc Klingen29e2e192e9e4
diff --git a/web/src/pages/api/auth/[...nextauth].ts b/web/src/pages/api/auth/[...nextauth].ts
index 7747a3f1d2..0e3d59aa46 100644
--- a/web/src/pages/api/auth/[...nextauth].ts
+++ b/web/src/pages/api/auth/[...nextauth].ts
@@ -48,5 +48,22 @@ export default async function auth(req: NextApiRequest, res: NextApiResponse) {
);
res.setHeader("Pragma", "no-cache");
res.setHeader("Expires", "0");
+
+ // Clean up the cookie from incident: https://status.langfuse.com/incident/770854
+ if (env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION) {
+ const langfuseUrls = {
+ US: "us.cloud.langfuse.com",
+ EU: "cloud.langfuse.com",
+ STAGING: "staging.langfuse.com",
+ HIPAA: "hipaa.cloud.langfuse.com",
+ DEV: "dev.langfuse.com",
+ } as const;
+
+ res.setHeader(
+ "Set-Cookie",
+ `__Secure-next-auth.session-token.${env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION}=; Path=/; Domain=${langfuseUrls[env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION]}; Expires=Thu, 01 Jan 1970 00:00:00 GMT; HttpOnly; SameSite=Lax`,
+ );
+ }
+
return await NextAuth(req, res, authOptions);
}