Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

cross-origin request blocked the same origin policy disallows reading the remote resource fix in node js node js

app.use(function (req, res, next) {
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE');
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
res.setHeader('Access-Control-Allow-Credentials', true);
next();
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #request #blocked #origin #policy #disallows #reading #remote #resource #fix #node #js #node #js
ADD COMMENT
Topic
Name
2+4 =