I'm using apache 2.4.23 under CentOS.
I have requests that are coming into apache that look like:
/path?key1=value&key2=value
I'm trying to remove the key1 parameter and value from the query string (such that it would be /path?key2=value)
I managed to do this with a modified rewrite example form the apache wiki:
RewriteCond %{QUERY_STRING} (.*)(?:^|&)key1=(?:[^&]*)((?:&|$).*)
RewriteCond %1%2 (^|&)([^&].*|$)
RewriteRule ^(/path)$ $1?%2 [P]
I use [P] because /path is a webapp path that gets forwarded to tomcat with ProxyPass. Without it, i'll get a 404, which is understandable.
My problem is, i also have a disk cache enabled on /path, so when i use the above rewrite rule, even though the query string is rewritten correctly, in the cache header files, i see that the original query string is in there and used to created a cache file, i.e. creating different cache files for different values of key1 instead of just for key2.
Is there any way i can rewrite the query string so that only the modified query string is used to create the cache files?
The only way i found so far is to do a redirect in the rewrite rule with [R]. I just don't want the extra overhead that goes along with that.
Thanks,
-Tony