Search code examples
apachetomcatapache2tomcat7mod-jk

find out own public address from within tomcat


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.


Solution

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