The requested resource does not have an "Access-Control-Allow-Origin" header. Origin "http: // localhost" is therefore not allowed
I have an app in AngularJS (ionic framework) and a server in Symfony.
In local mode everything works, but now I am doing my tests with a server on the internet. Unfortunately things are not the same as locally, I have the following error:
No "Access-Control-Allow-Origin" header is present on the requested resource. Therefore, the original address http: // localhost 'is not allowed.
I was wondering how to add the "Access-Control-Allow-Origin" CORS header which is missing.
+3
source to share
2 answers
Use this bundle: NelmioCorsBundle
CORS-Bundle is used to define CORS rules. This package allows you to define which domains will have access to your REST API. And it will make your job easier :)
+1
source to share