https://bz.apache.org/bugzilla/show_bug.cgi?id=64495
Bug ID: 64495
Summary: Rewrite rule threadlocal issue
Product: Tomcat 9
Version: 9.0.35
Hardware: PC
OS: Mac OS X 10.1
Status: NEW
Severity: normal
Priority: P2
Component: Catalina
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: -----
Hi,
I am using Rewrite Valve in my server with rewrite.config in the right
location. It was working fine. I recently upgraded from 9.0.34 to 9.0.35. I
found an issue with Rewrite rule matching.
Digging into the code I found the following,
https://github.com/apache/tomcat/commit/c4b71e31f3183ce3f4b8e86bd2cef49393a2a7e5#diff-2dc33ffdb9d224258577902518d5bfdc
In this particular commit the pattern variable for RewriteRule is made as
static. Because of this the first rule declared in rewrite.config is assigned
to this variable and all other RewriteRule's pattern are ignored.
Steps to reproduce:
In rewrite config declare two rules say,
RewriteRule ^/url1/(.*)$ /rewrittenurl1/$1 [L]
RewriteRule ^/url2/(.*)$ /rewrittenurl2/$1 [L,QSA]
Now give a request matching second rule i.e <domain>/url2/some/path. It will
try to math the url with pattern ^/url1/(.*)$ as the pattern variable is static
and is assigned with first RewriteRule parsed.
Additional request:
I am just curious to know why pattern is declared as a ThreadLocal instead of a
private variable.
Regards,
Melvin
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]