6 months ago

In axios request I got has been blocked by CORS policy error

Posted 6 months ago by mstdmstd

Hello, In laravel 5.8 / "vue": "^2.5.17" / "axios": "^0.18" I need to read external data which are read from postman ok :

I try to read these data using axios and got error:

in browse I see details of the request :

My JS code:, {
            "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?

  1. 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...


Please sign in or create an account to participate in this conversation.