Hallo,

my Application is deployed inside a Firewall and/or behind a Load-Balancer.

My application provies a web-app and an web-service. At some time i have to
call my own web-service from the web-app. In this case I have to use the
internal URL of my server.

At another time I have to give the public URL of my web-app to an interface
to other apps or services. In that caes i have to use the external URL of
my web-app. ( That is the URL of the firewall
or the load balancer)

For example:

The App is deployed internal on the Server with the name webserver1. So the
internal URL would be:

http://webserver1:8080/myapp/

But from outside the office I have to call the Url of the Firewall/Load
balancer:

http::// www.mycompany.com/myapp/



I found a way to read the current URL from the request:

HttpServletRequest request = (HttpServletRequest)
FacesContext.getCurrentInstance().getExternalContext().getRequest();
URL reconstructedURL;
reconstructedURL = new URL(request.getScheme(), request.getServerName(),
request.getServerPort(), "");

But the result is the internal URL, when the User is using the internal URL
and the external URL, when the user is using the external URL.


Is there a possibility to read  the internal server-name and port in any
case?


Thanks,

Gio

Reply via email to