====== キャッシュ削除 ====== 公式:https://www.varnish-cache.org/docs/4.0/users-guide/purging.html?highlight=ban ===== VCLに設定追加 ===== method「PURGE」で対象URLにアクセスすると、対象URLのキャッシュが削除できる。 # vi /etc/varnish/default.vcl acl purge { "localhost"; "192.168.24.0"/24; } sub vcl_recv { # allow PURGE from localhost and 192.168.24... if (req.method == "PURGE") { if (client.ip !~ purge) { return(synth(403, "Not allowed")); } ban("obj.http.x-url ~ " + req.url); # Assumes req.url is a regex. This might be a bit too simple } } sub vcl_backend_response { set beresp.http.x-url = bereq.url; } sub vcl_deliver { unset resp.http.x-url; # Optional } ===== ドメイン配下をまとめて削除 ===== # curl -X PURGE http://test.example.com ===== 特定のURLを削除 ===== # curl -X PURGE http://test.example.com/static/___test___/index.html