Problem with Axios headers | Application => Laravel + Vue.js

Asked

Viewed 243 times

0

I am trying to make a request with Xios, but I can’t always get the following error:

admin:1 Failed to load http://minhaurlencurtada: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://mv.test' is therefore not allowed access.

I tried to put the headers directly in Xios but I was not successful, when the request is made via php I have no problems so I discarded problems in the server, but after a lot of search and headers, I downloaded an extension in the browser Chrome that if called "Access-Control-Allow-Origin", she made it work normally without the error, I discarded the parameters passed in the url, now I doubt what it takes to make a request to an api from inside a Vue.js component?

  • 1

    You can find a detailed explanation about the problem here basically you are making a request to a server other than what serves your application files

  • I’ve done everything there is to know, and nothing! my problem is in solving this in Vue.js, pq if do outside the component works,already tried with Axios, Vue-Resource and ajax, but did not succeed!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.