Remapping Apache to a TC backend, but I would like to filter out unless a certain parameter is set.
ie. http://server/myapp?project=mine maps to http:server:8080/myapp?project=mine
There will be more parameters (though I will enforce project=mine as the last).
ProxyPassMatch works but not for parameters.
I tried
RewriteCond %{QUERY_STRING} project=mine
RewriteRule (.*) localhost:8080
Seems to be close, but testing in CURL I get: This document moved...
Which I do not get with ProxyPass or ProxyPassMatch
What am I missing ?
Tips/pointers/RTFMs appreciated
You need to use the
Pflag on theRewriteRuleto pass the request through mod_proxy, as opposed to being treated as an external 3xx redirect (ie. "this document has moved" msg).For example, if used directly in the
<VirtualHost>container:The condition checks for the URL parameter
project=mineat the end of the query string. Only the URL-path/myappis matched (as in your example).The
$0backreference contains the entire URL-path that is matched by theRewriteRulepattern. This simply saves repeating/myappin the substitution string.There are a few issues with your initial attempt (apart from the missing
Pflag):/anotherappwould also be caught. But this is also discarded.project=minematches that string anywhere in the query string, even as part of other URL params. eg.fooproject=minerwould also match.localhost:8080is not a valid substitution string.