Varnish cache only homepage first

Gourab Kumar

I am new to varnish cache.i have a website xyz.com and i want cache homepage first only so how to start with varnish and how will the vcl file look like for homepage cache only.

Please help.

Thijs Feryn

Here's some basic VCL code that will cache the homepage explicitly and rely on the built-in VCL behavior for all other requests.

vcl 4.1;

backend default {
    .host = "127.0.0.1";
    .port = "8080";
}

sub vcl_recv {
    if((req.method == "GET" || req.method == "HEAD") && req.url == "/") {
        return(hash);
    }
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related