Answer the question
In order to leave comments, you need to log in
How to disable CORS protection in nodeJS?
Good afternoon, in PHP, to disable CORS protection, I prescribe 3 headers:
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: *');
header('Access-Control-Allow-Headers: content-type');
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Methods", "*");
response.setHeader("Access-Control-Allow-Headers", "content-type");
Answer the question
In order to leave comments, you need to log in
You already wrote almost everything yourself, only you didn’t add origin to Access-Control-Allow-Headers . Need:
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Headers', 'origin, content-type, accept');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question