Tautvydas
Tautvydas

Reputation: 1288

Apache ProxyPass how to not proxy relative / child urls

Current config taken from apache configuration file:

ProxyPass                  /support      https://fe-help-help.staging/ retry=1 acquire=3000 timeout=600 Keepalive=On disablereuse=On smax=0 ttl=7
ProxyPassReverse           /support      https://fe-help-help.staging/

Issue is that child urls for example '/support/test' shouldn't be proxied, but now if you try to open '/support/test' it ends up being handled in 'https://fe-help-help.staging/'

Can we exclude all other route variations except specifically '/support' ?

Upvotes: 1

Views: 796

Answers (1)

Elvis Plesky
Elvis Plesky

Reputation: 3300

Try using ProxyPassMatch directive. From the documentation: This directive is equivalent to ProxyPass but makes use of regular expressions instead of simple prefix matching. The supplied regular expression is matched against the URL, and if it matches, the server will substitute any parenthesized matches into the given string and use it as a new URL.

For example:

ProxyPassMatch          ^/support$      https://fe-help-help.staging/ retry=1 acquire=3000 timeout=600 Keepalive=On disablereuse=On smax=0 ttl=7
ProxyPassReverse        /support        https://fe-help-help.staging/

Upvotes: 1

Related Questions