Purge /dyncss/ when a css file is changed
authorMagnus Hagander <magnus@hagander.net>
Thu, 14 Aug 2025 17:45:07 +0000 (19:45 +0200)
committerMagnus Hagander <magnus@hagander.net>
Thu, 14 Aug 2025 17:45:07 +0000 (19:45 +0200)
We serve combined CSS under that URL, so make sure it's purged along
with the static CSS.

tools/purgehook/purgehook.py

index 35e2127ed54774f57a885f2b11111d37869de231..73550dc18e32e9488bf02e95bc3b2fa41d798a84 100755 (executable)
@@ -47,6 +47,10 @@ if __name__ == "__main__":
             curs.execute("SELECT varnish_purge('^/' || %(u)s || '$')", {
                 'u': l.strip(),
             })
+
+            # If it's a CSS file, we also need to purge /dyncss/
+            if l.endswith('.css'):
+                curs.execute("SELECT varnish_purge('^/dyncss/')")
         elif l.startswith('data/'):
             # Data files map to xkeys with the same name as the file prefixed by data_
             curs.execute("SELECT varnish_purge_xkey(%(key)s)", {