Is the HTTP method PURGE idempotent in Varnish?

谁说我不能喝 提交于 2019-11-28 14:17:01

PURGE is not a standard HTTP method. It is just something configured in Varnish VCL - usually in this fashion or similar:

if (req.method == "PURGE") {
        if (!client.ip ~ purge) {
                return(synth(405,"Not allowed."));
        }
        return (purge);
}

(See: https://www.varnish-cache.org/docs/trunk/users-guide/purging.html)

When you call PURGE on a resource (URL) it will be removed from the cache (Varnish) so for the next GET request on the same resource Varnish will call the backend and cache its response. If you then call PURGE again on this resource it will be evicted from the cache again.

Yes, multipile PURGE requests return 200.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!