0

I'm trying to set up varnish as part of my lando (docker)-based development installation. It consists of 2 containers:

  • appserver, running Apache + PHP-FPM
  • varnish

Somehow, I fail to set up a correct VCL configuration file, resulting in fails like this, when BAN requests are made against the varnish from the appserver container:

BAN http:\/\/varnish\/` resulted in a `405 Not allowed from 172.29.0.3

This is happening with the following VCL rule:

acl purge {
    "localhost";
    "appserver";
    "127.0.0.1";
    "::1";
    "0.0.0.0/0";
    "128.0.0.0/1";
    "172.0.0.0/8";
}

I can ping from inside varnish container to appserver without any problem.

How can I fix my config, please? Please let me know, if my question is missing some info.

1 Answers1

0

I found out how to solve it. You have to allow an UNRESTRICTED PURGE or add X-VC-Purge-Key to header and assign a value to it. Here is my lando configuration :

services:
  varnish:
    type: varnish:6.0
    backends:
      - appserver
    backend_port: 80
    overrides:
      environment:
        VARNISH_SECRET: secret
        VARNISH_ALLOW_UNRESTRICTED_PURGE: 1