Shweta
Shweta

Reputation: 47

How to get the actual URL in case of load balancer proxy server

I am using Tomcat Server (two instances) to run my web applications. And apache web server as proxy server. I have used the proxy server as a load balancer to transfer the requests to the two instances of tomcat server.

In my logic, i have to differentiate between the requests coming from server URL directly or from proxy url. Is there a way to get the proxy URL in the java code of my web applications. Can I pass some extra parameters from load balancer itself to identify that the request is coming from proxy URL.

Please let me know if more information is required. Thanks in advance for your help.

Upvotes: 0

Views: 2445

Answers (1)

Gerard Cristofol
Gerard Cristofol

Reputation: 46

I'm assuming you are using mod proxy (mod_jk/mod_ajp preserves the proxy host)

Retrieve the "X-Forwarded-Host" header from request, which is the original host requested by the client.

See http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

Upvotes: 1

Related Questions