title: How to send a purge request in varnish
body: <p>I can't see a similar question, but apologies if I'm duping.</p>
  
  <p>We're running a varnish cache on our system, but want to install a system where we can purge individual pages when they are edited (fairly normal). We've been trying to get it to work by using an  HTTP header. So, our VCL is set up like:</p>
  
  <pre><code>acl purge {
        "localhost";
  #### Our server IP #####
  }
  
  sub vcl_recv {
      if (req.request == "PURGE") {
              if (!client.ip ~ purge) {
                      error 405 "Not allowed.";
              }
              return (lookup);
      }
  }
  
  sub vcl_hit {
      if (req.request == "PURGE") {
              purge;
      }
   }
  
  sub vcl_miss {
          if (req.request == "PURGE") {
                   purge;
          }
  }
  </code></pre>
  
  <p>However, I'm stuck on how to actually SEND the http purge request. We're using PHP for the website, so I've tried using:</p>
  
  <pre><code>header("PL: PURGE / HTTP/1.0");
  header("Host: url to purge");
  </code></pre>
  
  <p>But this doesn't seem to do anything  (and varnishlog doesn't seem to show anything purging).</p>
  
  <p>I've also experimented with cURL but, again, it doesn't seem to be working. Am I missing something really basic here, or is the basis sound, meaning my implementation is bugged?</p>
  
  <p>Many thanks,</p>