Apache ProxyPass - Regex to Exclude Files

Pedro Lobito picture Pedro Lobito · Jan 2, 2012 · Viewed 15k times · Source

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.

Answer

fge picture fge · Jan 2, 2012

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$ !