Nodejs Express CORS on POST call

  angular, cors, express, heroku, node.js

I have my nodejs express server app deployed on heroku, works fine in my local but once deployed i get the CORS MissingAllowOriginHeader error on just my POST requests the GET request works fine.

I have tried setting the headers using res.append, res.set and i have tried the following line:

app.use(cors({ origin: '*' , credentials :  true}));

Once i do that i get a 404 error that there is a mismatch with preflight origin.

I have tried


as well.

I have even tried using cors-anywhere.

I have tried sending headers through angular in the post call but i cannot resolve the CORS issue;

Source: Angular Questions

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.