Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const WS_TEST_PROTOCOL_PATH = "test_path.";
* Used for CORS.
**/
export const ALLOWED_PUBLIC_HEADERS = [
"Authorization",
"Content-Type",
"User-Agent",
HEADER_ACTOR_QUERY,
Expand Down
6 changes: 5 additions & 1 deletion rivetkit-typescript/packages/rivetkit/src/common/cors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import type { MiddlewareHandler } from "hono";
import { ALLOWED_PUBLIC_HEADERS } from "@/common/actor-router-consts";

const DEFAULT_ALLOWED_HEADERS = ALLOWED_PUBLIC_HEADERS.join(", ");

/**
* Simple CORS middleware that matches the gateway behavior.
Expand All @@ -18,7 +21,8 @@ export const cors = (): MiddlewareHandler => {
// Handle preflight OPTIONS request
if (c.req.method === "OPTIONS") {
const requestHeaders =
c.req.header("access-control-request-headers") || "*";
c.req.header("access-control-request-headers") ??
DEFAULT_ALLOWED_HEADERS;

c.header("access-control-allow-origin", origin);
c.header("access-control-allow-credentials", "true");
Expand Down
Loading