Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Add the domain as 'Host:' header #29

merged 2 commits into from

2 participants


Trying to purge, Varnish always returned "404 - Not in cache", as Varnish didn't know the host for which to purge, was the IP of Varnish, not the domain for which to purge.


i would have thought this happens automatically with $curlHandler = curl_init($this->domain); - are you sure this is not enough? i would suggest to move the additional code down there if we need it, otherwise the refreshPath method will not profit from it. just make sure to add to the array already existing at CURLOPT_HTTPHEADER if its there.


Done. No, the parameter passed to curl_init is just set as the CURLOPT_URL option, which is overwritten in the foreach.

@dbu dbu merged commit f9cab11 into from


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 22, 2013
  1. Add the domain as 'Host:' header

    Gunther Konig authored
Commits on Mar 27, 2013
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 1 deletion.
  1. +10 −1 Helper/Varnish.php
11 Helper/Varnish.php
@@ -120,10 +120,19 @@ protected function sendRequestToAllVarnishes($request, array $options = array())
$curlHandler = curl_init($this->domain);
- foreach ($options as $option => $value) {
+ $headers = array(
+ sprintf('Host: %s', $this->domain)
+ );
+ if (isset($options[CURLOPT_HTTPHEADER])) {
+ $options[CURLOPT_HTTPHEADER] = array_merge($headers, $options[CURLOPT_HTTPHEADER]);
+ } else {
+ $options[CURLOPT_HTTPHEADER] = $headers;
+ }
+ foreach ($options as $option => $value) {
curl_setopt($curlHandler, (int) $option, $value);
//Default Options
curl_setopt($curlHandler, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curlHandler, CURLOPT_HEADER, true); // Display headers
Something went wrong with that request. Please try again.