add allow-headers content-type

This commit is contained in:
Michael C 2022-01-06 21:31:34 -05:00
parent 7472af714a
commit 77de17c810
No known key found for this signature in database
GPG key ID: FFB04FB3B878B7B4
2 changed files with 2 additions and 0 deletions

View file

@ -1,6 +1,7 @@
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, DELETE';
add_header 'Access-Control-Allow-Headers', 'Content-Type'
# cache CORS for 24 hours
add_header 'Access-Control-Max-Age' 86400;
# return empty response for preflight

View file

@ -3,5 +3,6 @@ import { NextFunction, Request, Response } from "express";
export function corsMiddleware(req: Request, res: Response, next: NextFunction): void {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Methods", "GET, POST, OPTIONS, DELETE");
res.header("Access-Control-Allow-Headers", "Content-Type");
next();
}