Skip to content

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

fix: cors policy on generated api specification (#2707)

Marc Klingen05dd559d9656
diff --git a/web/next.config.mjs b/web/next.config.mjs
index d720a8ee91..e3a426c38b 100644
--- a/web/next.config.mjs
+++ b/web/next.config.mjs
@@ -80,23 +80,37 @@ const nextConfig = {
// Required to check authentication status from langfuse.com
...(env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION !== undefined
? [
- {
- 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",
- },
- ],
- },
- ]
+ {
+ 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",
+ },
+ ],
+ },
+ ]
: []),
+ // all files in /public/generated are public and can be accessed from any origin, e.g. to render an API reference based on our openapi schema
+ {
+ source: "/generated/:path*",
+ headers: [
+ {
+ key: "Access-Control-Allow-Origin",
+ value: "*",
+ },
+ {
+ key: "Access-Control-Allow-Methods",
+ value: "GET",
+ },
+ ],
+ },
];
},