So I was encountering the CORS issue in my angular client and since I cannot modify my server I found this proxy configuration in angular but am having trouble setting it up.
My Back End server : https://fbcontainer.dev.tests.com
development on : localhost:4200
an example ODATA endpoint that Im trying to reach : https://fbcontainer.dev.tests.com/exp/myapps/proj/UserService/users
my proxy.conf.json -
"/exp": {
"target": "https://fbcontainer.dev.tests.com",
"changeOrigin": true,
"secure": true,
"logLevel": "debug",
"pathRewrite": {
"^/exp": "https://fbcontainer.dev.tests.com"
}
}
}
I've added this to the angular.json under the serve section, and start the application with ng serve.
But as you can see the HTTP call still goes to the specified URL and not 'proxied'.
Access to XMLHttpRequest at 'https://fbcontainer.dev.tests.com/exp/myapps/proj/UserService/GetAccess()' from origin 'http://localhost:4200' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
in angular im using the HttpClient module for the http requests which I hope isnt the issue.
Tutorial i was following : https://www.c-sharpcorner.com/article/making-proxy-request-in-angular-fix-cors-issue-in-angular-application/
Hope its a mistake on my part and this can be fixed :).