I'm new to Tomcat (background in C# and IIS) and trying to achieve the following using Tomcat 5.5 on Windows.
- http://*.URL1.com and http://*.URL2.com point to the same Java app in Tomcat.
- All image requests from *.URL1.com should be served from /images1/...
- All image requests from *.URL2.com should be served from /images2/...
- All other files shared between the two URLs.
Obviously there's two parts to this:
1. serving the right image folder depending on the URL header
2. the * could be a number of different things (i.e. a number of different sub domains)
I'd rather use the wildcard (i.e. not have to specify all the sub domains).
Any suggestions need to be within the scope of Tomcat on Windows - I've inherited the application and don't have scope to change OS or server technology.
Although you could probably create a custom Valve in Tomcat to do all that, it's generally easier to delegate the process of re-routing and re-writing to a server where you can just code rules instead of writing and debugging code. One of the more popular ways of doing that is to front Tomcat with the Apache HTTPD server using mod_proxy and mod_rewrite.
An IDE is no substitute for an Intelligent Developer.