Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ You can also check the
- Chart more button is now correctly hidden when there are no actions
available
- Most recent value is now correctly resolved in interactive filters
- Miscellaneous
- Added CORS for admin.ch domains

# 5.9.0 - 2025-07-28

Expand Down
28 changes: 28 additions & 0 deletions app/middleware.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { NextRequest, NextResponse } from "next/server";

export function middleware(request: NextRequest) {
const origin = request.headers.get("origin");
const response = NextResponse.next();

if (origin && origin.endsWith(".admin.ch")) {
response.headers.set("Access-Control-Allow-Origin", origin);
response.headers.set("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
response.headers.set(
"Access-Control-Allow-Headers",
"Content-Type, Authorization"
);
}

if (request.method === "OPTIONS") {
return new Response(null, {
status: 204,
headers: response.headers,
});
}

return response;
}

export const config = {
matcher: ["/:path*"],
};
Loading