Pass CORS options to HttpApi backend (#25201)

This commit is contained in:
Kit Langton
2026-04-30 21:26:32 -04:00
committed by GitHub
parent 668d77bb4e
commit bc805b3001
5 changed files with 113 additions and 68 deletions

View File

@@ -11,7 +11,7 @@ import { basicAuth } from "hono/basic-auth"
import { cors } from "hono/cors"
import { compress } from "hono/compress"
import * as ServerBackend from "./backend"
import { isAllowedCorsOrigin } from "./cors"
import { isAllowedCorsOrigin, type CorsOptions } from "./cors"
const log = Log.create({ service: "server" })
@@ -67,7 +67,7 @@ export function LoggerMiddleware(backendAttributes: ServerBackend.Attributes): M
}
}
export function CorsMiddleware(opts?: { cors?: string[] }): MiddlewareHandler {
export function CorsMiddleware(opts?: CorsOptions): MiddlewareHandler {
return cors({
maxAge: 86_400,
origin(input) {