How to handle cors in express js? It works with the HTTP module but the origin in the header undefined in express js
I’m using the Express.js framework and trying to handle CORS, but req.headers.origin
is returning undefined
. I have a whitelist of allowed origins in my corsOptions
, and I’m checking the origin
in the headers. Why is the origin
header coming back as undefined
, and how can I fix it?