Reputation: 254
In angular application I have proxy.conf.json in this way
{
"/api/*": {
"target": "http://10.127.152.161:8080",
"secure": true,
"changeOrigin": true
},
"/rest/*": {
"target": "http://10.127.152.161:8080",
"secure": true,
"changeOrigin": true
},
"/auth/*": {
"target": "http://10.127.152.161:8080",
"secure": true,
"changeOrigin": true
}
}
Since in development mode, angular app runs on localhost:4200, setting target to ipv4 address:8080 is causing CORS Headers issue. For some reasons I have to use http://10.127.152.161:8080 not as localhost:8080 or 3000 port. I have added add_header 'Access-Control-Allow-Origin' '*'; nginx conf file but no luck. How to fix this?
Upvotes: 1
Views: 2073
Reputation: 443
set "secure": false and "changeOrigin": false
"/api/*": {
"target": "http://10.127.152.161:8080",
"secure": false,
"changeOrigin": false
},
Upvotes: 0
Reputation: 8251
set "secure"
property to false
.
{
"/api/*": {
"target": "http://10.127.152.161:8080",
"secure": false
},
...
Upvotes: 0