Skip to content

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

Fix CORS

Marc Klingen6370894e359a
diff --git a/next.config.mjs b/next.config.mjs
index a030613259..06b56682d9 100644
--- a/next.config.mjs
+++ b/next.config.mjs
@@ -4,6 +4,7 @@
*/
await import("./src/env.mjs");
import { withSentryConfig } from "@sentry/nextjs";
+import { env } from "./src/env.mjs";
/** @type {import("next").NextConfig} */
const nextConfig = {
@@ -21,6 +22,23 @@ const nextConfig = {
},
output: "standalone",
+ async headers() {
+ if (env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION !== undefined)
+ return [
+ {
+ source: '/api/auth/session',
+ headers: [
+ { key: "Access-Control-Allow-Origin", value: "https://langfuse.com" },
+ { key: "Access-Control-Allow-Credentials", value: "true" },
+ { key: "Access-Control-Allow-Methods", value: "GET,POST" },
+ { key: "Access-Control-Allow-Headers", value: "Content-Type, Authorization" },
+ ]
+ }
+ ]
+
+ return []
+ },
+
// webassembly support for @dqbd/tiktoken
webpack(config) {
config.experiments = {