I have a application which has apache and tomcat configured using mod_proxy_ajp.
We have configured it in httpd.conf as below:
# This is to redirect any request which is coming with hostname to Login.jsp
RewriteRule ^/$ /jsp/Login.jsp [R]
#include httpd-proxy.conf
<IfModule mod_proxy_ajp.c>
Include conf/extra/httpd-proxy.conf
</IfModule>
Into httpd-proxy.conf following is the proxy configuration:
<Proxy *>
AddDefaultCharset Off
Order deny,allow
Allow from all
</Proxy>
ProxyPass /jsp/ ajp://localhost:8009/jsp/
ProxyPassReverse /jsp/ ajp://localhost:8009/jsp/
in server.xml file for tomcat we have configured AJP connector as below:
<Connector port="8009" protocol="org.apache.coyote.ajp.AjpProtocol" redirectPort="8443" address="localhost"
enableLookups="true" maxThreads="500" connectionTimeout="120000" URIEncoding="UTF-8" />
Now when i access my machine with host name and ip address the request works fine and Login.jsp is displayed. However if i add an entry into hosts file on both server as well as client(from where browser is running) with some alias to original server name as below then it doesn't work.
some_ip_address original_host_name alias1 #This is alias
The request is redirected to Login.jsp when I make request as http://alias1 but the page is not coming up. In browser i can see the url as http://alias1/jsp/Login.jsp but page is not coming up. In apache ajp logs I can see response code is 200. So not sure where exactly is the problem Can anybody please help me