Federico Nardone Aggiutorio
asked on
Angular, proxy works in local but not in remote
Dear users,
in my Angular 10 appI have a proxy file; all API call are forwarded to other link. In local it works perfectly; in remote not.
1) The call is a fake REST call I found in the web; so, the problem is for sure not this.
2) In remote, I push the app under a GIT and the build is created by a CI/CD process implemented from other developers.
3) I already added "proxyConfig": "proxy.conf.json" in my angular.json under serve; if there were the error, it wouldn't work also in local. So, the error is not in this point, I think.
I have the sensation, the proxy doesn't work only in remote. How can I solve the problem? Where could I find the error? Thank so much!
in my Angular 10 appI have a proxy file; all API call are forwarded to other link. In local it works perfectly; in remote not.
1) The call is a fake REST call I found in the web; so, the problem is for sure not this.
2) In remote, I push the app under a GIT and the build is created by a CI/CD process implemented from other developers.
3) I already added "proxyConfig": "proxy.conf.json" in my angular.json under serve; if there were the error, it wouldn't work also in local. So, the error is not in this point, I think.
I have the sensation, the proxy doesn't work only in remote. How can I solve the problem? Where could I find the error? Thank so much!
ASKER
Thank you very much for your reply; I try to explain by semplifyng as much as possible by an example.
In my Angular app I call a fake REST endpoint, we can assume, a free fake eindpoint available on the web. I have a proxy.conf.json with the row "target": "www.testapi.com/addressbook".
On local, by ng serve, all works correctly and I receive in my terminal an output with a list of address. If I upload on remote server, it doesn't work and I see the html code of the home page (tipical behaviour of a missing data retrieving).
Why it's happens? How can I reach this fake end point also from the server?
In my Angular app I call a fake REST endpoint, we can assume, a free fake eindpoint available on the web. I have a proxy.conf.json with the row "target": "www.testapi.com/addressbook".
On local, by ng serve, all works correctly and I receive in my terminal an output with a list of address. If I upload on remote server, it doesn't work and I see the html code of the home page (tipical behaviour of a missing data retrieving).
Why it's happens? How can I reach this fake end point also from the server?
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
This is the same for your proxy, so when using a proxy (whatever that might mean), your proxy must be listening on a public IP.
If I understand your question above, likely this is the problem.