אנונימי123
משתמש מקצוען
הוספתי ,את צריכה להוסיף CORS:
מקור:קוד:Try adding the following middleware to your NodeJS/Express app (I have added some comments for your convenience): // Add headers app.use(function (req, res, next) { // Website you wish to allow to connect res.setHeader('Access-Control-Allow-Origin', '*'); // Request methods you wish to allow res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE'); // Request headers you wish to allow res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type'); // Set to true if you need the website to include cookies in the requests sent // to the API (e.g. in case you use sessions) res.setHeader('Access-Control-Allow-Credentials', true); // Pass to next layer of middleware next(); });
No 'Access-Control-Allow-Origin' - Node / Apache Port Issue
i've created a small API using Node/Express and trying to pull data using Angularjs but as my html page is running under apache on localhost:8888 and node API is listen on port 3000, i am getting t...stackoverflow.com
באמת אין בעיות אבטחה אבל אותו דבר....
נערך לאחרונה ב: