Bug 57863 - Can't get the matched pattern in RewriteValve
Summary: Can't get the matched pattern in RewriteValve
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 8
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 8.0.x-trunk
Hardware: All All
: P2 normal (vote)
Target Milestone: ----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-28 06:09 UTC by Tatsuya Bessho
Modified: 2015-04-28 20:38 UTC (History)
0 users



Attachments
patch against trunk. (1.14 KB, patch)
2015-04-28 06:09 UTC, Tatsuya Bessho
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.