Merge pull request #1752 from sdvcrx/add-cors-cache

Add maxAge config to cache CORS preflight request
This commit is contained in:
Mike Cao 2023-01-25 08:44:49 -08:00 committed by GitHub
commit 4b1013c8c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,7 +11,10 @@ import { getUser } from '../queries';
const log = debug('umami:middleware');
export const useCors = createMiddleware(cors());
export const useCors = createMiddleware(cors({
// Cache CORS preflight request 24 hours by default
maxAge: process.env.CORS_MAX_AGE || 86400,
}));
export const useSession = createMiddleware(async (req, res, next) => {
const session = await findSession(req);