-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I enable CORS (Cross-Origin Resource Sharing) ? #68
Comments
Same as #64 |
This features is already added in v3.1.0. (Sorry, I forget to close it) |
It seems like CORS still isn't enabled on the local server. I tested using test-cars.org and returns an error when trying to GET one of the files from the server. Any additional steps I'm missing? Anything that needs to be enabled in the settings? |
I still can't access .json files from external domains. Am I forgetting to set something up? |
I'm using Safari version 11.1.2 the endpoint is |
Using 5.4.0, I'm getting the same problem when trying to call https://api.flickr.com/services . This is with Firefox. |
Same issue here in Chrome, Firefox and Edge on Windows 10. Edit: I seem to have fixed my issue by simply loosening the CORS settings on my target resource. Now I don't get any errors anymore regarding a missing 'Access-Control-Allow-Origin' header. |
Temporary suggestion -> #249 (comment) |
Still hasn't been fixed. |
Same problem XHRGEThttp://example.com/movies.json Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://example.com/movies.json. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 404. Uncaught (in promise) TypeError: NetworkError when attempting to fetch resource. |
Still some times its not working... please fix this |
same problem, I use the latest Live Server v5.7.5 you can try |
same problem here with Live Server v5.7.9 |
https://marketplace.visualstudio.com/items?itemName=yandeu.five-server maybe use five-server instead |
Access-Control-Allow-Origin can have three possible directives (*, origin, or null) to tell the browser from which origin can one access certain resources. The issue is with the response from the backend which is/was missing appropriate header. Thats why the issue is occurring "sometimes"; with some URLs or with other tools as well. And it should be unrelated to liveserver in vscode. One cannot fetch a resource that they are not allowed to fetch. So, your backend should return response with header Access-Control-Allow-Origin as wildcard (*) or specify the origin. If you specify the origin, the origin must match with your server (if you make request from example.com; the origin must be example.com). You can check the headers using cURL with --head parameter for further troubleshooting of the backend responses. Also, some sources are available here:
There is also very very nice explanation of how the header works here: |
Failed to load http://xxxxxx.com//assets/i18n/it.json: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:5500' is therefore not allowed access.
The text was updated successfully, but these errors were encountered: