diff --git a/lib/index.js b/lib/index.js index ad899ca..18ee171 100644 --- a/lib/index.js +++ b/lib/index.js @@ -216,14 +216,18 @@ } if (originCallback) { - originCallback(req.headers.origin, function (err2, origin) { - if (err2 || !origin) { - next(err2); - } else { - corsOptions.origin = origin; - cors(corsOptions, req, res, next); - } - }); + originCallback( + req.headers.origin, + function (err2, origin) { + if (err2 || !origin) { + next(err2); + } else { + corsOptions.origin = origin; + cors(corsOptions, req, res, next); + } + }, + req.path + ); } else { next(); }