I should mention that to configure hostB (e.g. 192.168.0.2) to listen to hostA 
(e.g. 192.168.0.1), I simply added 

Listen 192.168.0.2:80 
Listen 192.168.0.2:443 

to hostB httpd.conf file. I did not create a virtual host (is that OK?). I also 
didn't modify httpd.conf on hostA. 

----- Original Message -----

From: modjkl...@comcast.net 
To: "Tomcat Users List" <users@tomcat.apache.org> 
Sent: Sunday, January 8, 2017 9:57:32 PM 
Subject: 404 errors accessing webapp URLs using local IP address on fresh 
Tomcat 8.5.9 install 

I have two Linux servers connected via a cross-connect cable with internal IP 
addresses 192.168.0.1 (hostA) and 192.168.0.2 (hostB). 

hostA runs CentOS 5, and hostB CentOS 7. 

hostB runs Apache 2.4.x, and Tomcat 8.5.9. All web traffic gets routed to port 
443 (e.g. HTTPS) of Apache web server hostB. All web application traffic (e.g. 
https://www.example.com/mywebapp/somepage) is then passed to Tomcat via mod_jk 
version 1.2.42 on port 8009. Additionally, hostB Apache web server is 
configured to listen on 192.168.0.2 port 8009 (hostA Apache web server is not 
configured as such). 

If hostA attempts to access a webpage on hostB (via hostB external IP address) 
from a browser or command line, such as: 
[root@hostA ~]# curl -I http://www.example.com/mywebapp/somepage 

it returns status 200 (good). 

Now, if I modify the hostA /etc/hosts file hostA accesses to my website 
(www.example.com) on hostB through the cross-connect cable (e.g. 192.168.0.2 
rather than the external IP address), the webpage returns error 404. 

What can I change to get status 200? 

My web addresses are xxx.xxx.xxx.xxx (e.g. IPv4). I know Tomcat configures IPv6 
by default. So, I modified the setenv.sh as follows: 

CATALINA_OPTS="-Xms512M -Xmx1024M -Djava.awt.headless=true 
-Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses=true" 

This didn't change the result. 

As another clue, I observe that hostA always reports status 200 (good) when 
accessing any hostB webpage in www.example.com that is NOT part of /mywebapp, 
for both internal and external IP addresses. 

Any ideas what I can try to resolve this? I'm new to Tomcat and this is fresh 
install (previously used GlassFish) on a brand new server. Thanks in advance 
for any advice. 

Reply via email to