Skip to content

Instantly share code, notes, and snippets.

@section-io-gists
Created February 16, 2017 04:34
Show Gist options
  • Save section-io-gists/2a49ba6d3b3e4dde9283d76c8b56dc53 to your computer and use it in GitHub Desktop.
Save section-io-gists/2a49ba6d3b3e4dde9283d76c8b56dc53 to your computer and use it in GitHub Desktop.
Split Varnish Cache by the request header X-Forwarded-Proto - Useful when the origin is doing GEO IP redirects or changing content according to protocol
sub vcl_hash {
#Vary cache by protocol type to avoid caching things like HTTP->HTTPS redirects and different versions of files
hash_data(req.http.X-Forwarded-Proto);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment