ProxyPassMatch with ProxyPassReverse ProxyPassMatch with ProxyPassReverse apache apache

ProxyPassMatch with ProxyPassReverse


You're close, try changing the regex a little to account for the version fragment:

ProxyPassMatch ^/.*?/APP.*?/v[0-9]+/(.*)$ http://localhost:8080/AppContext/$1

The ProxyPassReverse is mostly to ensure the rewriting on-the-fly of location header fields in the responses given by the proxied app. So when it returns a 301 redirect to, say, http://localhost:8080/AppContext/something, apache knows to change it to /APP/v1/something so information behind the proxy won't get exposed. Because you have a dynamic URL used in the reverse proxy, you have a few choices here. You can either send it to the HAProxy load balancer (not sure where that is for you), or you can just pick one and hope for the best. For example, if you have a load balancer at /APP/balancer/ which then sends requests to /APP/v1/, /APP/v2/, /APP/v3/, etc. Then you can do this:

ProxyPassReverse /APP/balancer http://localhost:8080/AppContext

Otherwise, you can just point it to one and hope for the best:

ProxyPassReverse /APP/v1 http://localhost:8080/AppContext