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

Jérémie,

On 2/17/15 10:47 AM, Jérémie Barthés wrote:
> I don't have more to say than :
> 
> "There is a bug using the RewriteValve :If you are targeting a
> folder and there is no "/" at the end of the URI,

The end of which URI? The one in the rewrite rule? Or the one the
client sends in the URL?

> the rewritten URI is visible for the client browser (302
> redirection). Example : http://myhost.com/myFolder =>
> http://myhost.com/rewriteTrick/myFolder/ instead of 
> http://myhost.com/myFolder => http://myhost.com/myFolder/";

It looks like in this case, the rewrite rule isn't matching, and the
DefaultServlet is performing redirection instead. This sounds like a
configuration mistake on your part, not a bug in the rewrite valve.

> The bug is solved for me. I just wanted to tell developers about
> it.

- -chris

> Le 17/02/2015 15:34, Christopher Schultz a écrit : Jérémie,
> 
> On 2/17/15 6:20 AM, Jérémie Barthés wrote:
>>>> I just installed tomcat 8 and used the RewriteValve to
>>>> forward some old URLs on my new tomcat8 webapp. I had an
>>>> issue for URIs targeting a folder: If there is no "/" at the
>>>> end of the URI, the rewritten URI is visible for the client
>>>> browser (302 redirection). Example :
>>>> http://myhost.com/myFolder => 
>>>> http://myhost.com/rewriteTrick/myFolder/ instead of 
>>>> http://myhost.com/myFolder => http://myhost.com/myFolder/
>>>> 
>>>> I made a custom patch on RewriteValve to solve it. I would
>>>> like to know if it'll be corrected on next releases. (i tried
>>>> on 8.0.18 but there is still the issue)
>>>> 
>>>> Regards,
>>>> 
>>>> Jeremie Barthes Oodrive France
>>>> 
>>>> 
>>>> 
>>>> Between lines 480 and 500 :
>>>> 
>>>> boolean folderRedirect = false; try{ 
>>>> request.getMappingData().recycle();
>>>> 
>>>> request.getConnector().getService().getMapper().map(request.getCoyoteRequest().serverName(),
>>>>
>>>>
>>>>
>
>>>> 
request.getCoyoteRequest().requestURI(),
>>>> null, request.getMappingData());
>>>> 
>>>> if(request.getMappingData().redirectPath.toString()!=null){ 
>>>> folderRedirect = true; } } catch (Exception e){ //ignore }
>>>> 
>>>> request.getMappingData().recycle(); // Reinvoke the whole
>>>> request recursively try {
>>>> 
>>>> request.getConnector().getProtocolHandler().getAdapter().service
>>>>
>>>> 
(request.getCoyoteRequest(), response.getCoyoteResponse());
>>>> if(folderRedirect && response.getCoyoteResponse().getStatus()
>>>> == 302){
>>>> 
>>>> if(!request.getCoyoteRequest().requestURI().getByteChunk().toString().endsWith("/")){
>>>>
>>>>
>>>>
>>>> 
String requestParam = request.getQueryString() == null ? "" : '?'
>>>> + request.getQueryString(); response.setHeader("Location", 
>>>> request.getCoyoteRequest().requestURI().getByteChunk().toString()
>>>> + '/' + requestParam); } } } catch (Exception e) { // This
>>>> doesn't actually happen in the Catalina adapter
>>>> implementation }
> The best practice would be to file an enhancement request in
> Bugzilla, write and attach a test case that demonstrates the
> problem (or describe it in very great detail... from the above, I
> don't know what you have changed and why), and attach your changes
> (as a patch, using "svn diff" or something similar) to the Bugzilla
> issue.
> 
> -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
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJU44rQAAoJEBzwKT+lPKRYLwEQAJgAdh33TnTRbkRtBfugTc5D
8VwtHftAfL6ykdbGTYllInSfhxZkWH3fA7gxqBb18TaICqw0sxAVg1TaKIjtEwYb
TQzxryNJQsg1fJ97L56EauRJyKikO0OTE7XUT8S5TIr/Z0YuhfQzIOKA+KvzyiUE
rDbJ4N4TA41fvgA7aCdeQluDGJ/sOnFVotq5sSp6j41XSCAfWXrg8r+FlVegPJm8
fblHS3E19PTvv/IuJaNDPefafpdLoyiMYnfPgC8MKYbfipUCJLyl30ZTjiBw2Jmi
9SGqPFkk9y2Yk72R5ihL1dExb332nBwV7xZIVJsyDysKWW2OYI/XY7BYwSW8rguA
05hdEetI1UFgWavh6imqzWoDpOV35Pi+crYB+ZUDeDHfHCxjhvyxlXhXFtp6QkB+
yODHW4qXA4QPjsSNG+I6letaDA2lvxDNlzjip/iSsjEfwOMj6E6vnqkW7oD92YxF
lcNaqI9weDDJwaJZUrra3dxqR4VYj0WcmHsUY/+uqQhh083KKPhpJ6r54xL9Dv4N
1vFdJIRelhX2YxlXTUS5Jx/vhEHGS5P95un92tdP46WyOS9s3Jkutigt5E4I9AaG
v9AdGlDZwah9q8sJ00U1tqGdkMwRdY12KHtY9loWRY1T7Gn3pAzPIcNSvvCR8OE2
uCigdMtsLsOMvqIPz5Mh
=xqs9
-----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