From 07254bba492014866e10e7a355d2501ac5fc730b Mon Sep 17 00:00:00 2001 From: Max Gurela Date: Wed, 13 Apr 2016 14:05:33 -0700 Subject: [PATCH] Add cors pre-flight handling --- routes/upload.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/routes/upload.js b/routes/upload.js index 31ad9fc..0fac712 100644 --- a/routes/upload.js +++ b/routes/upload.js @@ -39,6 +39,10 @@ var storage = multer.diskStorage({ var upload = multer({ storage: storage, limits: {fileSize: config.MAX_UPLOAD_SIZE}, fileFilter: util.fileFilter }); + +/* Handle CORS pre-flight requests */ +router.options('/', cors()); + /* POST upload page. */ router.post('/', cors(), upload.array('files[]', config.MAX_UPLOAD_COUNT), function(req, res, next) { var files = [];