⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.96
Server IP:
147.93.97.220
Server:
Linux srv843233 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64
Server Software:
nginx/1.28.0
PHP Version:
8.2.29
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
varnish
/
vcc
/
View File Name :
vmod_purge.vcc
#- # Copyright (c) 2017 Varnish Software AS # All rights reserved. # # Author: Dridi Boukelmoune <dridi.boukelmoune@gmail.com> # # SPDX-License-Identifier: BSD-2-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. $ABI strict $Module purge 3 "Varnish Purge Module" DESCRIPTION =========== *vmod_purge* contains functions that offer a finer-grained control than ``return(purge)`` from ``vcl_recv{}``. The functions can only be called from ``vcl_hit{}`` or ``vcl_miss{}`` and they should in general be used in both to ensure that all variants of a same object are taken care of. EXAMPLE ======= :: sub vcl_recv { if (req.method == "PURGE") { if (client.ip !~ purge_acl) { return (synth(405)); } return (hash); } } sub my_purge { set req.http.purged = purge.hard(); if (req.http.purged == "0") { return (synth(404)); } else { return (synth(200)); } } sub vcl_hit { if (req.method == "PURGE") { call my_purge; } } sub vcl_miss { if (req.method == "PURGE") { call my_purge; } } sub vcl_synth { if (req.method == "PURGE") { if (req.http.purged) { set resp.http.purged = req.http.purged; } return (deliver); } } $Function INT hard() This is equivalent to ``return(purge)`` but explicitly called from ``vcl_hit{}`` and ``vcl_miss{}``. It returns the number of purged objects. Example:: set req.http.purged = purge.hard(); $Restrict vcl_hit vcl_miss $Function INT soft(DURATION ttl = 0, DURATION grace = -1, DURATION keep = -1) Sets the *ttl*, *grace* and *keep*. By default, *ttl* is set to 0 with *grace* and *keep* periods left untouched. Setting a negative value for *grace* or *keep* periods leaves them untouched. Setting all three parameters to ``0`` is equivalent to a hard purge. It returns the number of soft-purged objects. $Restrict vcl_hit vcl_miss SEE ALSO ======== * :ref:`vcl(7)`