Search code examples
regexapachemod-rewriteload-balancingproxypass

Apache ProxyPass - Regex to Exclude Files


I'm trying to exclude all files starting with "dgg-" and ending in ".xml", example: dgg-file-1.xml from using the apache proxy.

This works:

ProxyPass /myfile.xml ! # single file
ProxyPass /directory ! # all files inside dir

This doesn't work:

ProxyPass /dgg-(.*)\.xml !

How can I achieve this ?

ps- I'm using this code inside the httpd.conf->virtualhost not .htaccess.


Solution

  • Use ProxyPassMatch. ProxyPass expects fully written path elements, it does not accept regexes.

    As ProxyPassMatch takes a regex, this means you must also anchor it:

    ProxyPassMatch ^/dgg-[^.]+\.xml$ !