Varnish Exclude URL with Regex


#1

Hi there,

I want to exclude any caching of my google feed xml files. They look like this:

/wp-content/uploads/wppfm-feeds/Scotch-Whisky-Single-Malt-Speyside.xml
/wp-content/uploads/wppfm-feeds/Scotch-Whisky-Blended.xml
/wp-content/uploads/wppfm-feeds/Scotch-Whisky-Grain.xml
/wp-content/uploads/wppfm-feeds/World-Whisky.xml
/wp-content/uploads/wppfm-feeds/Spirits-and-Liqueurs-Gin.xml
/wp-content/uploads/wppfm-feeds/Spirits-and-Liqueurs-Vodka.xml
/wp-content/uploads/wppfm-feeds/Spirits-and-Liqueurs-Rum.xml 

I want to use a regular expression to exclude every file from varnish… here is my best guess.

/wp-content/uploads/wppfm-feeds/(.*)

Would this work?

Best regards,

Jethro


#2

You’re super close – you need to escape the forward slashes in regex. See https://regex101.com/r/Mub5vw/1


#3

Lucas, thanks so much for the reply! Makes sense. Seems to be working perfectly!!