-
Notifications
You must be signed in to change notification settings - Fork 1.6k
GET call failing - Access-Control-Allow-Origin #652
Comments
If you can use api for any origins then... mode: 'no-cors' |
Conero, '*" isn't correct value for this header, you know. try it with 'http://127.0.0.0:8080' or 'localhost'. |
Gagydzer is corrent allowing origins from any source is not correct and could be a security issue. I have seen chrome refusing to communicate with some api having * as that header value. I have also seen this error when I had some errors in my php code. Since the page you try to contact has error it might not send 'Access-Control-Allow-Origin' because php returns a default page with the errors. I don't say this is your case but I suggest try to contact your api with a third party plugin for chrome like postman. |
Try to use jsop |
i solved this issue, because i use "Vue.http.interceptors.push" before. then i use "Vue.http.interceptors.before" i solved this problem. |
Hello @stevenkitter, would you be so kind and provide an minimal code example ? I am really interested on this. |
Solution for Express:
Or use this headers config in your app. |
Hello, I have the same problem with my application, I am working in development mode with an express server published in [localhost: 3001] and my client goes in [localhost: 8080], I am using vue-resource for requests and the interceptor for Authentication headers.
All the requests I make return the same to me:
To verify that my server was functioning correctly, I created an angular application with a simple request and proxified as is, and it worked perfectly, so the question is why does this happen to me when I use vue-resource? It is truly frustrating. I would appreciate if someone could explain to me why from Postman and Angular I can access the services without problems and from Vue using vue-resource no. Thanks. |
I'm trying to make a GET call to an external API that I can't adjust the settings on. It works great in POSTMAN, but when I do it through the browser I get the Access-Control-Allow-Origin error. Full error is below:
"XMLHttpRequest cannot load https://api.com/parameters/etc&etc=etc. 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:8080' is therefore not allowed access. The response had HTTP status code 400."
I see this is a fairly common issue, and the consensus seems to be to "adjust the server settings", but unfortunately I can't do this here. Is there another solution?
The text was updated successfully, but these errors were encountered: