You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by mo...@comcast.net on 2017/01/09 05:57:32 UTC

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. 

Re: 404 errors accessing webapp URLs using local IP address on fresh Tomcat 8.5.9 install

Posted by mo...@comcast.net.
Thanks for the help Christopher, 

I resolved this by adding 192.168.0.2 to hostB's httpd.conf file as a VirtualHost, then including JkMount for mod_jk. 

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

From: "Christopher Schultz" <ch...@christopherschultz.net> 
To: "Tomcat Users List" <us...@tomcat.apache.org> 
Sent: Tuesday, January 10, 2017 11:50:27 AM 
Subject: Re: 404 errors accessing webapp URLs using local IP address on fresh Tomcat 8.5.9 install 

-----BEGIN PGP SIGNED MESSAGE----- 
Hash: SHA256 

To whom it may concern, 

On 1/9/17 12:57 AM, modjklist@comcast.net wrote: 
> 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. 

What does hostA say when you issue "host [hostB]" from the command-line? 

- -chris 
-----BEGIN PGP SIGNATURE----- 
Comment: GPGTools - http://gpgtools.org 
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ 

iQIcBAEBCAAGBQJYdTsDAAoJEBzwKT+lPKRYQY8QAL2d3o6cqoNJ4ENxOA9al6i+ 
VETnlJ5JjDsAC0hzbd0c8eRZj8NryptV9hbx7nmVeIRNs+Pgr56BxIsmih+QGT+p 
vDCdeJEfcYXPdStpPOmBu1u+FfCJDIUEFevxigqYsvav/1UUXdoV3aW8ThyQaddd 
30ecS9NmTaijYZjHA/ufTOymuFgSnwAwkO7PbwV1hWG/JNqnXNLM+Dywkv/5CqH/ 
DpbquCyiDrvDZVCBsvOUIRGfXyH3czxOHycGfl8GarNoskuvrc9gxHkSwc3HvIau 
qlfd7g9SICwrLeVcm02SbTkkUJV/xIV6p5csPMKt5bID3+MciX+XjOoFlo6GWVGY 
6UtZ0OFvznvgb2wgOMEmf9N1ORqj1a8765VDae2oTJhpNoygW55/WwJT/s24gohz 
xEGTw5Fqddo8s8IzTWbIOChWSwQ1V/1gtjJJgn/O/JUyAobFvMipWAGLztfo/w4V 
+shtlh/+rRAigFrgc7cYAfp4+SMbnDCD4MBJHBdrgjAQuH1bg4+CbdN6WkhNsi0+ 
rcPFUJUQPxmdN1HtYAUmeXXEfMPuMJNhP3Dsq6L7RpEmKAFdkwrPe2AXkP/TzbeH 
yy/4M1Ng1EBMZuWHnEylo3o0A4qtp139o3B/gJiwZ5CVnQXxCwv0MsjiY9Z6wPPm 
FuzFy8TTIECLskz4vn5C 
=LNg6 
-----END PGP SIGNATURE----- 

--------------------------------------------------------------------- 
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org 
For additional commands, e-mail: users-help@tomcat.apache.org 



Re: 404 errors accessing webapp URLs using local IP address on fresh Tomcat 8.5.9 install

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

To whom it may concern,

On 1/9/17 12:57 AM, modjklist@comcast.net wrote:
> 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.

What does hostA say when you issue "host [hostB]" from the command-line?

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJYdTsDAAoJEBzwKT+lPKRYQY8QAL2d3o6cqoNJ4ENxOA9al6i+
VETnlJ5JjDsAC0hzbd0c8eRZj8NryptV9hbx7nmVeIRNs+Pgr56BxIsmih+QGT+p
vDCdeJEfcYXPdStpPOmBu1u+FfCJDIUEFevxigqYsvav/1UUXdoV3aW8ThyQaddd
30ecS9NmTaijYZjHA/ufTOymuFgSnwAwkO7PbwV1hWG/JNqnXNLM+Dywkv/5CqH/
DpbquCyiDrvDZVCBsvOUIRGfXyH3czxOHycGfl8GarNoskuvrc9gxHkSwc3HvIau
qlfd7g9SICwrLeVcm02SbTkkUJV/xIV6p5csPMKt5bID3+MciX+XjOoFlo6GWVGY
6UtZ0OFvznvgb2wgOMEmf9N1ORqj1a8765VDae2oTJhpNoygW55/WwJT/s24gohz
xEGTw5Fqddo8s8IzTWbIOChWSwQ1V/1gtjJJgn/O/JUyAobFvMipWAGLztfo/w4V
+shtlh/+rRAigFrgc7cYAfp4+SMbnDCD4MBJHBdrgjAQuH1bg4+CbdN6WkhNsi0+
rcPFUJUQPxmdN1HtYAUmeXXEfMPuMJNhP3Dsq6L7RpEmKAFdkwrPe2AXkP/TzbeH
yy/4M1Ng1EBMZuWHnEylo3o0A4qtp139o3B/gJiwZ5CVnQXxCwv0MsjiY9Z6wPPm
FuzFy8TTIECLskz4vn5C
=LNg6
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: 404 errors accessing webapp URLs using local IP address on fresh Tomcat 8.5.9 install

Posted by mo...@comcast.net.
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: modjklist@comcast.net 
To: "Tomcat Users List" <us...@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.