I've got a jspx that needs to know the current HttpServletRequest's getServerName(). The jspx can fetch this with #{mybean.serverName} from its bean, like this:
public String getServerName() {
HttpServletRequest request = (HttpServletRequest) FacesInstance.getCurrentInstance().getExternalContent().getRequest();
return request.getServerName();
}
However, when this is served behind a proxy (Apache with mod_proxy), getServerName() will some times return the node's host name instead of the frontend's host name. Other times it works correctly.
A plain jsp with <% request.getServerName(); %> will, however, always return the frontend's host name.
What's the problem with FacesInstance's HttpServletRequest? Is there a way to fetch the "real" request object?