I use a remote service URL to retrieve data and use in my angular 6 project. Since it was producing CORS issue most times, I had to use proxy.config.json. Configuration is like below:
In angular.json, inside architect, inside serve, I gave an option like:
"proxyConfig":"proxy.config.json"
And inside proxy.config.json,
{
"/push/*":{
"target":"https://abc.xyz.bluemix.net/",
"secure":false,
"logLevel":"debug",
"changeOrigin":true
}
}
While running in localhost, when any url with path as /push is visited, it automatically sets fetches data from url https://abc.xyz.bluemix.net/push/123
I need to know if there's a way to enable proxy on cloud too. Reason is that the application runs on https://sample-dev.bluemix.net due to which CORS issue occurs in absence of proxy.
The problem i face is that after these configurations, when i did a Build with a build cmd ng build --prod
and push to cloud, when /push is visited, the response i get is the content in index.html and not the json data which am supposed to receive like how i received in local. I am thinking if it is due to directory structure.
Bottomnote: Enabling CORS headers in server end is not under my control. URLs are fake ones