• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tomcat on Windows - rewriting or similar based on URL?

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

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.

Thanks!

Alex
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Alex!

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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic