1

I have tomcat application (war file) which people can deploy as they wish. For example by using http/https connectors in Coyote, or using mod_jk/mod_proxy to let Apache handle incoming http/https.

A problem that I am having is that I need to figure out the public address that the server is deployed at from within the application. Is there any way to extract this from the incoming request? For example when the application is deployed through mod_jk with the ajp13 back-end, I would still like to know that the request was originally done to https://myserver.com.

Jeroen Ooms
  • 31,998
  • 35
  • 134
  • 207

1 Answers1

0

Use jsonip, this way you can do it on startup and don't need to wait for a request.

ripper234
  • 222,824
  • 274
  • 634
  • 905
  • That's not going to help at all. That won't tell me if tomcat is being hosted on http or https. Nor will it show when the server is actually being accessed through a (http) proxy server. – Jeroen Ooms Dec 28 '11 at 21:21
  • @Jeroen - I see, I thought you meant IP address - you should specify you mean HTTP address. Doesn't the request object have something that can help you? – ripper234 Dec 28 '11 at 21:28
  • Well so suppose the request is being proxied through mod_jk over ajp13. Then I think the request object will contain the request from mod_jk to tomcat, instead of the original https request? – Jeroen Ooms Dec 29 '11 at 02:41
  • @Jeroen - if your server is inside a local proxy, and is not exposed to the internet in itself, then it might be impossible to find the external address of the proxy server. Perhaps in the HTTP headers somewhere. I suggest you open the HttpRequest object in a debugger and have a look. – ripper234 Dec 29 '11 at 07:35