0
試圖請求CORS請求與代碼:如何使用&符號休息收集處理標題「訪問控制 - 允許來源」?
export default Collection.extend({
model: person,
url() {
return 'http://127.0.0.1:5000/person/'
},
ajaxConfig: function() {
return {
headers: {
'Access-Control-Allow-Origin': 'http//:127.0.0.1:3000'
},
xhrFields: {
withCredentials: false
}
};
},
})
我發送請求與訪問http //:127.0.0.1:3000但如果使用*我仍然得到以下錯誤
XMLHttpRequest cannot load http://127.0.0.1:5000/person/. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access.
如何處理這種請求?