alphagov/pp-puppet — pull request #296 by robyoung (2014-03-19 18:33:17+00:00)
Title: Improve PURGE request handling in Varnish

All requests coming into Varnish have a client.ip of localhost as they
come from Nginx on the same machine. This change checks for the
X-Real-IP header that is set by Nginx and prevents PURGE requests if it
is present.

This is really nasty. Unfortunately Varnish doesn't let you check
arbitrary headers against an acl.

Also, we have logic that switches between the backdrop read and write APIs
based on the verb. This catches PURGE requests and allows them to be
passed on to get handled by the PURGE section below.