Reputation: 8406
I have a Tomcat app that is acting as a web server/gateway to Sun Systems Connect (which is itself the gateway to Systems Union Accounts that I suspect is the gateway to happiness).
I can access the app's login page via a browser as long as I use the machine name (or localhost when local). But neither the machines IP nor Localhost allows me to see the login page.
Sun tell me this is a 'feature' of Tomcat. Unfortunatly the accounts machines in development and in production have the same name (different domains) so I can't tell if I am running tests on the dev or live box. Short of changing the box names can I force Tomcat to accept IPs?
Upvotes: 0
Views: 158
Reputation: 75496
Tomcat doesn't know anything about IPs. IP is just treated as hostname. You need to make sure the configuration allows the IP. You have a few options to achieve this.
If you add a defaultHost for the engine, any non-matching hostname or IP will use this virtual host. For example,
<Engine name="Standalone" defaultHost="example.com">
If you want more control, you can also add the IP as an alias, like
<Host appBase="webapps" name="example.com">
<Alias>192.168.1.2</Alias>
</Host>
There are many other reasons that an IP may be rejected,
Looking at logs may show you the exact cause.
Upvotes: 1
Reputation:
http://tomcat.apache.org/tomcat-4.1-doc/config/valve.html talks about a resolveHosts flag that forces a DNS lookup, also maybe with adjusting the pattern shown to one of the %A parameters you could list the IP address in the log.
Upvotes: 0
Reputation: 70220
It's been a while since I used Tomcat, but I thought by default you could call the web service via either name or IP address. I don't know if this will help, but you could try setting a virtual host for the IP address in server.xml
, e.g. add a stanza something like
<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true">
but replacing "localhost" with your machine's IP address.
Upvotes: 0