My application built on Angular + NGRX, fetching data from server. Server is hosting services built on Java Spring.
Spring services are hosted on a specific domain, thus in angular we are accessing them using specific url say
http://JavaService-hostedDomain/ServiceName
In spring specific Controllers are built for them @GetMapping(/ServiceName)
Now issue what i am facing is that to view the application, i have to disable chrome web security using
--disable web security chrome command to launch chrome
then application is loading correctly.
On running in chrome without disabling Chrome web security, i am getting following error
XMLHttpRequest cannot load http://localhost:4200/url. Response to
preflight request doesn't pass access control check: No
'Access-Control-Allow-Origin' header is present on the requested resource.
How to resolve above CORS error, is changes required on Angular(Client Side) or Java (Server side) ?
If possible any way to resolve this by making changes only on Angular side ?