tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gabor Pinter <g-pin...@pearl.kobe-u.ac.jp>
Subject Re: url prefixes behind proxy
Date Fri, 07 Jan 2011 04:54:34 GMT
Dear Christopher,

Thank you for your reply.

 >> Tomcat is version 6.0
 >
 > 6.0.what? We're just dying to know.

Sorry, it's 6.0.29 .
(Though at my level, the third digit may be of minor importance :)


 > http://localhost:8080/tom     ->    path/to/tomcat/webapps/tom
 >> http://localhost:80/tom/     ->    path/to/tomcat/webapps/
 >
 > My example above is better because it will actually work.

I can see that.
But doesn't this mean that you need to add a proxy_pass for each app you 
deploy under webapp?
Plus the root app in Tomcat also needed to be moved from "/".

I can live with that, I'm just curious if it is possible to use
a global prefix ('/tom' is a bad example, say '/servlet') for a redirection.

http://localhost:8080/servlet/  -->  path/to/tomcat/webapps/

 >> nginx -->  apache -->  django
 >> setup on the server (working just fine).
 >
 > Aah, unnecessary complexity: I just love it.

The concept is from an Apress django book.
Would you live nginx out? Or Apache?
Or django?

I'm open to any suggestions.

Gabor




On 2011-01-07 06:23, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Gabor,
>
> On 1/6/2011 2:38 PM, gabor wrote:
>> Tomcat is version 6.0, but it is highly experimental under my hands ;-)
>
> 6.0.what? We're just dying to know.
>
>>> You have configured* the proxy to expect Tomcat to have either tom.war
>>> or a directory deployed in tomcat/webapps called 'tom'.
>>>
>>> e.g
>>>    path/to/tomcat/webapps/tom.war
>>>
>>> or
>>>    path/to/tomcat/webapps/tom/
>>
>> Oh, I'm sorry not to say that.
>> I would like to access Tomcat root through url http://localhost:80/tom/ .
>
> No, you want to access the "tom" webapp through URL
> http://localhost:80/tom/.
>
>> Say, to change the textbook example:
>> http://localhost:8080/     ->    path/to/tomcat/webapps/
>
> Unless you have butchered your configuration, the above path
> (path/to/tomcat/webapps/) does not contain a webapp. Instead, it
> contains directories where webapps live. Can you try this instead:
>
> http://localhost:8080/tom     ->    path/to/tomcat/webapps/tom
>
>> to:
>> http://localhost:80/tom/     ->    path/to/tomcat/webapps/
>
> My example above is better because it will actually work.
>
>> Probably the more difficult part is when a webapp publishes a link,
>> (e.g., to a .jpg) without the prefix /tom/  ->  which in turn is not proxy
>> redirected by nginx to Tomcat... (404.htm)
>
> So... do you want URLs of the form /not_tom/whatever.jpg to be
> redirected to your /tom context, or are you saying that NginX should
> send those requests elsewhere and so Tomcat doesn't care about them?
>
>> I'm thinking to use a prefix to redirect because
>> - I am going to have only port 80 open for the public
>
> Not really relevant, but understandable.
>
>> - there are also some static (+a few php) pages
>
> Also not a problem: all of this can be handled with NginX by only
> mapping appropriate requests to Tomcat, regardless of their URL prefix.
>
>> (would be great just leave them as they are now)
>> - there is also an
>> nginx -->  apache -->  django
>> setup on the server (working just fine).
>
> Aah, unnecessary complexity: I just love it.
>
>> Django serves from behind a prefix, that's why I thought to approach
>> Tomcat in a similar fashion.
>
> Fine. Just deploy your webapp as /tom and be done with it. It will work
> exactly as you'd like it to. It's the simplest possible thing you could
> do, and it meets your needs.
>
>> Well, basically I use the default server.xml.
>> Only the<Host>  tag is hacked as described above.
>
> Undo that and go back to default server.xml. Then, put your "tom" webapp
> under path/to/tomcat/webapps/tom. Restart Tomcat and everything should
> work as desired.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk0mMs0ACgkQ9CaO5/Lv0PC4BACeKfmpx57LRtGeLzp8W1uCwIsw
> ToAAoJtw88ZWxerVDLEWq8OhflGxyIl9
> =Pg4c
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message