-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Jérémie,

On 2/19/15 10:05 AM, Jérémie Barthés wrote:
> I made a scenario to make the issue happens :
> 
> Use a tomcat 8.0.18
> 
> Make a file rewrite.config in conf/Catalina/localhost/ that
> contains : RewriteRule    ^/mypath/(.*)$    /examples/jsp/$1
> 
> copy the line <Valve 
> className="org.apache.catalina.valves.rewrite.RewriteValve" /> in
> the conf/server.xml file, line 131
> 
> launch the server
> 
> try the followings URLs : http://localhost:8080/mypath/async 
> http://localhost:8080/mypath/async/
> 
> the result i have is : http://localhost:8080/mypath/async => 
> http://localhost:8080/examples/jsp/async/ (visible rewrite) 
> http://localhost:8080/mypath/async/ =>
> http://localhost:8080/mypath/async/

That's exactly the behavior I'd expect, since you have mapped
/mypath/async to /examples/jsp/async, which is a directory. The
DefaultServlet tries to serve that "directory" and redirects the user
to the same URL with a "/" on the end.

This isn't necessarily a problem with the RewriteValve, but with a
perhaps unexpected result of those two components together.

Can you provide a patch to RewriteValve? I'd prefer to see what you
actually changed, instead of just a snippet of "fixed" code.

- -chris

> Le 19/02/2015 15:25, Jérémie Barthés a écrit :
>> Tell me what you need about my configuration :
>> 
>> rewrite.config file : RewriteRule    ^/jamfiles/(.*)$
>> /newapp/jamfiles/$1 RewriteRule    ^/workspace/(.*)$
>> /newapp/htdocuments/workspace/$1 RewriteRule
>> ^/([a-zA-Z0-9]+)(\.jsp|\.html|\.txt)$ /newapp/htdocuments/$1$2
>> 
>> tomcat version : 8.0.15 (tried on 8.0.18 too)
>> 
>> Operating System : tried on windows 7 and unix
>> 
>> Le 19/02/2015 15:15, Christopher Schultz a écrit :
> Jérémie,
> 
> On 2/19/15 4:54 AM, Jérémie Barthés wrote:
>>>>> When an URL target a folder on the server, tomcat
>>>>> automaticly add a "/" at the end of the URL if missing :
>>>>> myHost.com/myFolder => myHost.com/myFolder/ (automatic
>>>>> tomcat 302 redirection)
>>>>> 
>>>>> If you use a rewriteValve to forward "myHost.com/myFolder"
>>>>> to "myHost.com/rewriteTrick/myFolder", the rewriteValve
>>>>> will forward simultaneous with the automatic tomcat
>>>>> redirection. Then the client's browser will catch the
>>>>> rewritten URL (you don't want the rewritten URL to be
>>>>> visible for the client's browser). myHost.com/myFolder
>>>>> redirect to myHost.com/rewriteTrick/myFolder/ (visible)
>>>>> 
>>>>> So i made a patch to block the RewriteValve if an automatic
>>>>> 302 tomcat redirection is applied. Then the RewriteValve
>>>>> forward in a second time and the rewritten URL is not
>>>>> visible for the client's Browser : myHost.com/myFolder
>>>>> redirect to myHost.com/myFolder/ forward to
>>>>> myHost/rewriteTrick/myFolder/ (not visible)
>>>>> 
>>>>> It may be a configuration mistake of my part. I tried many 
>>>>> different configurations to avoid it but i wasn't able
>>>>> without coding a patch.
> It /may/ be a configuration problem. We won't know until you post
> your configuration.
> 
> -chris
>>> 
>>> ---------------------------------------------------------------------
>>>
>>> 
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>>
>> 
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>> 
> 
> 
> ---------------------------------------------------------------------
>
> 
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJU5iJ/AAoJEBzwKT+lPKRYJO8QALg30zvUh0LBMjnQ0bHpNcVh
xWJcwbEQMF1L3js1PRJFDLwhW6wARuHHmkg2mUTVkjXzI8B+UFdzK64tef+OuxIe
Q5JGGHTHhmoRbqlc5daVgiRjBz3PT2gx4uB87/Ub6qAsVKF1zKqOiz9d6kxRFmu/
t/kcAHaoy+N3cNULn/kpjt47DgNh10eSFrjEfXoBQUIWA9up39kfAfLFabitJcCp
QSDtUUD/YODlj2g6jGcIaKvZ0gfAwRCi1wF9ZXVEj9kCHuHWDxStQF8atPB5Rqtx
0wt4dnZvOaEkE2P26T+8K66Tn430bvQFCJl39PD4Hkq6zlWibpLoe4XZmVnzNMRu
xDy7IpHaBa2nwVJCFzSk42/uHRt3XzxqR0RTZmF3+tUyK9H30H5HanCeE66yA7kR
Blfxyln6I6M1klgBkKB2eFaw9BUzI4Ad2T3k87hzoxgVJnQjr+J0HrphNHu/YbLC
n6H9Hjhqdlc2pemaQWal7inh9T1G+juphwQwo27l9ozU5MrZrZjXEm13ILLginV4
dYf9Fo7ZMpA7DFyRgdtRtP2GmtTnw3FP8ovdleruzNgf+F+ZV5tzn6R1/7gzFtBA
Eqvq7+qRzScP/zGdbRO8HrIJ9zQsDN/ltal/PfEJAUm2zM3gAsUG8vzF0cHdLArx
OfdCrrVkm4sUBrl9YAOX
=kGdG
-----END PGP SIGNATURE-----

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

Reply via email to