Home > other >  ProxyPass Exclude path
ProxyPass Exclude path

Time:12-09

i configured an apache proxy to forward all calls to another web server. I need to exclude the path http://my-server/{var1}/api/{all-path} (where var1 is variable) from this rule.

How can I do?

Thanks

I tried with:

ProxyPassMatch ^/(.*)/api/(.*)$ !
ProxyPass / http://127.0.0.1:8080/

but not working.

CodePudding user response:

I'd say you need a negative lookahead in your matching pattern and only a single proxy directive:

ProxyPassMatch ^/[^/] /(?!api/) http://127.0.0.1:8080/

That should match any path starting with something and a following slash, followed by anything that is NOT "api/".

  • Related