Q:

Localhost call from Angular http$ only works locally in W2k8 R2

I am trying to deploy the angular front end on a Windows 2008 R2 (don't blame me) that calls JAVA REST on the same server but different ports. Everything works fine if I browse from the server but not if I try from another computer.
What happens is that angular tries to call the server using localhost from the client computer, not the server. 
If I replace localhost for the IP address of the server, it works from another computer inside my network, but not from outside.
It is not a CORS or firewall (turned off) problem, I already tried messing with host file, tried using IIS and nginx.
My question is: -How can I force the requests to localhost to "stay" in the server and not the client??

A:

If you're trying to make the application call a local api (only visible to the server) you can't do it via an angular app. Angular runs in your browser, so when you open the webpage, the app starts running in your browser, which means the context that you provide to the app has to be completely public, and perhaps gated with a token access or something similar.
If there's no way that you can make that java REST service public so the app can call it from everywhere, I suppose the only way that you can solve this is have another service which is public, which is called by your angular app, and it calls to this java REST endpoint.
As a general rule of thumb, you should remember that any app that you can view from the browser - if they were coded with async-javascript libraries likes angular / reach / knockout etc.. is basically public, so the service calls they make can be traced, where as a server side rendered webpage (asp.net MVC / JSP with Java) can make server calls and the client won't see that.

