Problem/Motivation

Whatever I set as Request Method BAN or PURGE I get the following in the logs when I execute drush p-queue-work.

purger_varnishbundled_83033cae2a: item failed due GuzzleHttp\Exception\ServerException, details (JSON): {"msg":"Server error: `BAN http:\/\/localhost:8080\/` resulted in a `501 Not Implemented` response: 501 Not Implemented<\/title> <\/head>
Not (truncated...) ","uri":"http:\/\/localhost:8080\/","method":"BAN","guzzle_opt":{"http_errors":true,"connect_timeout":1,"timeout":1},"headers":{"user-agent":"varnish_purger module for Drupal 8.","cache-tags" etc.

I don't see anything wrong in my varnish default.vcl:

  if (req.method == "PURGE") {
    # Check if the IP is allowed.
    # purge is the ACL defined at the begining
    if (!client.ip ~ purge) {
      # Return error code 405 (Forbidden) when not.
      return (synth(405, "This IP (" + client.ip + ") is not allowed to send PURGE requests."));
    }
    return (purge);
  }

  # Ban logic to remove multiple objects from the cache at once. Tailored to Drupal's cache invalidation mechanism
  # Only allow BAN requests from IP addresses in the 'purge' ACL.
  if (req.method == "BAN") {
      # Same ACL check as above:
      if (!client.ip ~ purge) {
          return (synth(403, "Not allowed."));
      }

      if (req.http.Purge-Cache-Tags) {
          ban("obj.http.Purge-Cache-Tags ~ " + req.http.Purge-Cache-Tags);
      }
      else {
          ban("obj.http.x-url ~ " + req.url + " && obj.http.x-host == " + req.http.host);
      }

      # Logic for the ban, using the Cache-Tags header. For more info
      # see https://github.com/geerlingguy/drupal-vm/issues/397.
      if (req.http.Cache-Tags) {
          ban("obj.http.Cache-Tags ~ " + req.http.Cache-Tags);
      }
      else {
       else {
          return (synth(403, "Cache-Tags header missing."));
      }

      # Throw a synthetic page so the request won't go to the backend.
      return (synth(200, "Ban added."));
  }

I tried all kind of settings but still blocked on this. Any help welcome.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

erwangel created an issue.