INNER CODE UNIT · TypeScript
evaluateCors
fancyboi999/Loomic · apps/server/src/app.ts:349
function evaluateCors(request: FastifyRequest, webOrigin: string): CorsResult {
const origin = request.headers.origin;
const isPreflight =
request.method === "OPTIONS" &&
typeof request.headers["access-control-request-method"] === "string";
if (!origin) {
return {
allowed: true,
allowOrigin: null,
isBrowserRequest: false,
isPreflight,
};
}
if (origin === webOrigin) {
return {
allowed: true,