I am trying to setup a home website (say "www.mycoolsite.com") with Apache2-->mod_jk/ajp13-->Tomcat6. When I go to the site from outside network by typing my home IP, it works ok. But when I go to www.mycoolsite.com, it does not work. I examined a debug-level logging from mod_jk, and see that request comes in, mod_jk finds a wildcard match, connects to Tomcat6 socket, sends request via AJP13, but in response gets 302 "Moved Temporarily", and eventually apache2 returns index.html. In case when I type IP address instead of domain name, everything is the same except response from Tomcat is not 302 but correctly rendered page.
So it looks like Tomcat refuses to serve requests that comes with domain name. I have VirtualHost *:80 in apache2 named "www.mycoolsite.com", and also in Tomcat's Engine defaultHost="www.mycoolsite.com" and a Host with name="www.mycoolsite.com". I am running standalone Tomcat6 from inside Eclipse, but have the above settings in server.xml in Tomcats conf folder and also in Eclipse's Server deployment folder. What I am doing wrong, please help?
it doesn't matter what "virtualhost" is called in apache, try to check apache ServerName and ServerAlias for this virtualhost
and remember that ServerName is passed to tomcat through AJP, and tomcat needs revelant entry: hostname = apache servername
Thank you for the hint, the config parameters were as you described, names were matching. But the culprit turned out to be very simple -- the ServerName I was using was too long (because I mistakenly thought it must be same as domain name) -- 31 chars total. After I shortened the server/host names things work fine.