tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pete <>
Subject Re: Can multiple URLs with a single IP address be mapped to discrete Applications in Tomcat 4.0?
Date Sun, 03 Feb 2002 07:15:26 GMT
What you are after is essentially a 'Layer-7 Switch'

I do this with the SQUID proxy server and a perl script which rewrites 
HTTP requests using regular expressions to match URL fragments.

e.g. all our domains are pointed at a single IP, and i map requests for 
external domain namesservers to internal servers e.g. gets mapped to http://192.168.x.x:8080/myapp/

There are a few hurdles to overcome with this approach, chiefly that 
cookies get set based on the server name and directory, which means that 
you need to match webapp names - i.e. you need to map 
http://externally.visible.domain/myapp to 
http://internally.visible.domain/myapp - trying to map e.v.d/myapp to 
i.v.d/someotherapp probably won't work properly with sessions etc.

Also, you'll probably need to use absolute URLs in your JSPs etc. , 
since the client and the web server have different ideas about exactly 
what is being requested.

I believe Apache has built-in URL-rewriting features, and Tomcat may do 
as well, however, I find SQUID works reliably for what I want to do, so 
I have not looked for another solution.

One thing to be aware of with the SQUID approach is the fact that your 
proxy server is effectively opened to the net, and clients are free to 
request arbitary URLs from your proxy, letting them use your bandwidth 
to fetch their URLs. I see a surprisingly high level of abuse for a 
fairly obscure and little-used web server, with requests for banner-ads, 
machines with obvious viral infections and others trying to exploit my 
'open' proxy server.

However, a small perl script run daily by cron that parses the SQUID 
access log and bans IPs with IPTables that match abuse patterns takes 
care of that pretty quickly.

Hope that helps


Micael Padraig Og mac Grene wrote:

> Clear question: No answers????
> The subject, supra, asks the question.  If you have a number of URLs 
> pointed to a single IP address, can you map the URLs somehow to discrete 
> web applications in Tomcat 4.0?
> I have read everything I know to read and cannot get the answer to 
> this.  I know I could do it with JBoss and Tomcat 3.2.4 and the context 
> manager.  But, I don't see that in Tomcat 4.0.  What's up?
> Sure is hard to get a response to this question.  Have no idea what.  
> Please don't tell me the stuff that is simple and covered like how to 
> set up directories, etc.  I know how to handle aliases, how to handle 
> multiple IP addresses on the same machine, etc.  My question is 
> specific.  How can I get, e.g. and when they 
> are pointed to a given IP address, (for example), to map 
> to webapps/aaaaa and webapps/bbbbb?  Or, is this not now possible?
> Some people have suggested that, since I don't know the answer to this, 
> I need to essentially take the classes I teach for fun.  Lord.  If only 
> they could answer the question instead of loading me with pompous 
> self-righteous drivel.  I do thank those who have tried.  I don't know 
> where to look at this point.  I may just write the classes to do it.
> Micael
> -- 
> To unsubscribe:   <>
> For additional commands: <>
> Troubles with the list: <>

To unsubscribe:   <>
For additional commands: <>
Troubles with the list: <>

View raw message