Skip to content

[Cookbook] [Cache] Missing vcl_recv routine for purging and missing acl example #2653

Closed
@ThijsFeryn

Description

@ThijsFeryn

The Varnish documentation in the cookbook isn't 100% correct. In order to purge you need to make sure the PURGE method is dealt with in vcl_recv, otherwise Varnish is going to fallback on default behaviour.

This means Varnish will consider it a non-RFC-compliant method, will pipe the request to the backend and ignore the Varnish caching mechanisms.

To avoid that simply catch PURGE requests and immediately perform a lookup to the cache. By doing this you'll skip default behaviour.

It's just a matter of adding the following piece of VCL

sub vcl_recv {
    if (req.request == "PURGE") {
        return(lookup);
    }
}

A full example of an acl would also be interesting.

I'm going to create a pull request and link to this issue as a reference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    actionableClear and specific issues ready for anyone to take them.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions