tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Apache mod_jk connector question about alias
Date Wed, 19 Oct 2016 23:58:39 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Marc,

On 10/18/16 7:59 PM, Marc Chamberlin wrote:
> On 10/17/2016 10:36 AM, Rainer Jung wrote:
>> 
>> Alias maps URIs to local file system directories. JkMount maps
>> URIs to remote back end requests.
>> 
>> You can not change JkMount forwarding using Alias (except that if
>> you have a comflict between Alias and JkMount only one of them
>> wins).
>> 
>> As far as I understand you are not really trying to map requests
>> to the local web server file system, but instead want to forward
>> to a Tomcat back end but change the URI path which is used when
>> accessing Apache to something else being used to acces Tomcat.
>> E.g. the URI /jsp-examples/something gets used when accessing
>> Apache and mod_jk should send this request as
>> /examples/jsp/something to the Tomcat back end.
>> 
>> If you really need to change URIs, then often mod_proxy is much
>> easier to set up, because it has specific directives for this
>> (ProxyPass etc.).
>> 
>> With mod_jk you would first need to use mod_rewrite RewriteRules
>> to change the URI, and then JkMount to forward them. More details
>> can be found at
>> 
>> http://tomcat.apache.org/connectors-doc/common_howto/proxy.html#URL%2
0Rewriting
>>
>>
>>
>> 
The rest of this docs page might be useful as well.
>> 
>> Regards,
>> 
>> Rainer
>> 
> Thanks a million Rainer, you got me over that hump! I have it
> working now but have another question - When the response is
> generated for a request, that used the alias in the URL, is there a
> way to keep the client browser from displaying what the alias got
> mapped to?
> 
> So for example, if I use the alias in the URL - 
> http://www.mydomain.com/jsp-examples  that I send to the Apache
> server, and it in turn forwards that request to Tomcat as 
> http://www.mydomain.com/examples/jsp, I would prefer that the
> response, sent back to the user, contains the original, aliased or
> unaliased, version of the URL that he/she typed, and not just the
> resolved version. As it stands I am always getting the response URL
> of http://www.mydomain.com/examples/jsp displayed in the client
> browser.
> 
> What follows is my current version of the config file that I am
> using for the jsp-examples. Seems to be working mostly OK, so
> hopefully I am on the right track. FYI - I intend to include these
> config files in various virtual hosts configurations each of which
> have their own document root, hence the reason for the Alias
> commands at the beginning of this config file.
> 
> Thanks again in advance for any and all offers of help, thoughts,
> and replies...

Your best bet is to name the context in Tomcat to be whatever you
really want the URL path to be. This will remove all kinds of problems
you are likely to see in the future because of your decision to try to
rewrite URLs.

I never understand why people would rather spend a great deal of time
configuring around the fact that this simple command will get
everything working without any other issues:

$ mv webapps/name-you-have webapps/name-you-want

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJYCAivAAoJEBzwKT+lPKRYANAP/Rh2kvvCHDkVam0HOPky9az3
J9KfYb8JVw/G65iNbyYH+PYBpetYragZAKXm8TqID3H5o95yGCFU4A0TduoqVA2R
hqmkM6vXbLclsENL44lJDPiYR7EhO8CwoDe764YzXvB7OMzGSwlNG4jI6SmBHxNO
SdvFE8G6bYAGj5zqA+hATMNHv/VhY2esgHbx4rV46hmDouh23yyUVZiu6LEFg0LQ
ThDgZzhvURRrb9xv4J78Ml0PMcD/v3F7cYJvlZwU2boLoD9c8p+nTgX+7tN4TZ9d
fYsOAuLLWfxQUj/WddN9JjosdkEmf8bdXivBH5JCe5RYeSO1BgVqhxi4PEIp5tUs
zTDN5Xb7g+9pnz8Lo5bDYwzNU+BYqtOSI+HdKC8x2Pu+rGGde3q040QEIJIPInaD
Ef0Fr8OInhC4z3MnI3dtS8iB6q8k5wwAk9l+2Nt3Up6oAlPUG/jT3xY66oFnr7wS
Q1w/M6uwRrmeU/7jjmIOfI+pcgYhOkj2+iRbyBkXvcOazmHDJz3mMx2wdEHSqTE6
5VHW5zqcgOZCTasXQ648KWW/0ajsQvAaU5rMjqJdTHrlpHlWeD2cyPxE1MeOxBq/
PBkuA2rCTwew9P8yeFyiInJtf5l17jbB+IlpaNzEr/ukDob+2BhqmKdUWlCACLp7
iZiAhqne7jaNJEwZL0zp
=z2Vs
-----END PGP SIGNATURE-----

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


Mime
View raw message