Reputation: 1797
My nodejs app is using cors:
const cors = require('cors');
app.use(cors());
Thanks to that, I can send requests from my client (from another ip address). POST and GET work. They got a:
Content-Type: application/json; charset=utf-8
However, when I upload a file, I get a cors error. The content type is then:
Content-Type: multipart/form-data;
In my app.js I have stuff like:
app.use(bodyParser.json({ limit: "200mb" }));
app.use(bodyParser.json({ type: 'application/json'}));
What can I do to solve this issue?
Upvotes: 0
Views: 43
Reputation: 36
Have you tried using app.use(bodyParser.urlencoded({ extended: false }))
also
you can reference this post: CORS problem if "Content-type": "multipart/form-data"
Upvotes: 1