Bug 57863

Summary: Can't get the matched pattern in RewriteValve
Product: Tomcat 8 Reporter: Tatsuya Bessho <t.bessho0331>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 8.0.x-trunk   
Target Milestone: ----   
Hardware: All   
OS: All   
Attachments: patch against trunk.

Description Tatsuya Bessho 2015-04-28 06:09:58 UTC
Created attachment 32692 [details]
patch against trunk.

Key of RewriteMap does not work correctly.

-----
ex) rewrite.config
RewriteCond %{HTTP_USER_AGENT} ^Mozilla.*
RewriteMap hoge com.hoge.HogeRewriteMap
RewriteRule /foo/(.*).html$ /bar/${hoge:$1}
-----

$1 does not refer to (.*).
Key is always used a fixed string $1.
As a result, URL after rewriting is /bar/null.
Comment 1 Mark Thomas 2015-04-28 20:38:26 UTC
Thanks for the analysis and the patch.

I have committed a slight variation (allow for $10+) and added some test cases.

The fix has been made in trunk (for 9.0.x) and tc8.0.x/trunk for 8.0.22 onwards.