I have some existing config to redirect traffic to a different service depending on the URL path, and if no path matches defaults to a "main" load balanced service
<Proxy balancer://main>
BalancerMember http://main-service01:8080
BalancerMember http://main-service02:8080
</Proxy>
ProxyPreserveHost on
ProxyPassMatch "/server.txt" !
ProxyPassMatch "^/register/(.*)$" http://register_service/$1
ProxyPassMatch "^/login/(.*)$" http://login_service/$1
ProxyPassMatch "^/lookup/(.*)$" http://lookup_service/$1
ProxyPassMatch ".*" balancer://main-service nofailover=Off maxattempts=3 timeout=5
This works! Now I wish to extend the functionality so if the request contains HTTP header environment = dev, the request should be directed to the dev server instead of the main server in the event the path does not match one of the other conditions
I tried adding this just above the ".*" case but did not work
RewriteCond %{HTTP:environment} dev
RewriteRule (.*) http://dev:8080/$1 [P]