@mstdmstd The resource at example.com:9090/searchWeb needs to add the Access-Control-Allow-Origin header with the value of the domain where /website-blogs is hosted.
May 14, 2019
6
Level 8
In axios request I got has been blocked by CORS policy error
Hello, In laravel 5.8 / "vue": "^2.5.17" / "axios": "^0.18" I need to read external data which are read from postman ok : https://imgur.com/a/SRBmK0P
I try to read these data using axios and got error: https://imgur.com/a/o97xLm7
in browse I see details of the request : https://imgur.com/a/EUkyV43
My JS code:
axios.post(window.REMOTE_SEARCH_WEB, {
"query": "pc gamers",
"blogger": false,
"company": false,
"influencer": false,
"article": false,
"pageId": 1,
"sort": null,
"sortOrder": null,
"searchType": 1,
"Access-Control-Allow-Origin": this.app_url,
"Access-Control-Allow-Methods": "POST",
"Access-Control-Max-Age": 86400,
"Access-Control-Allow-Headers": "Content-Type, Authorization",
'Access-Control-Allow-Credentials': 'true'
}).then((response) => {
where this.app_url is home url of the site the app run at. Googling I found several parameters Access-Control-* must be filled, like in code above, but that did not help me. Can you say how I to fix it?
- can it be that a desicion could be from my js code with axios to run action in my control and from there to make request using php/laravel ? If yes, please provide example of such decision...
Thanks!
Please or to participate in this conversation.