Search code examples
varnishvarnish-vclvarnish-4

Err_Connection_Refused after modifying Varnish default file


I have properly installed varnish 4. Varnish is on port 80 while apache on port 8080.

After editing /etc/varnish/default.vcl and inside sub vcl_backend_response writting to cache static files:

if (bereq.url ~ “(woff|woff2|jpg|jpeg|png|gif|css|js|less)”) {
set beresp.ttl = 3600s;
}

I get Err_Connection_Refused

I don't understand what I have done wrong?


Solution

  • You probably copied the code from somewhere on the internet. There are code styling components out there, that replace quotation marks with other characters.

    Please mind, there is a subtle but visible difference between “” and "". Without further error description, you might start and change the quotation marks.

    The final result should look like this:

    if (bereq.url ~ "(woff|woff2|jpg|jpeg|png|gif|css|js|less)") {
        set beresp.ttl = 3600s;
    }