Seperate Varnish caching for HTTP and HTTPS

A high traffic site I host for a client needed to be available on both HTTP and HTTPS. This particular site, though, needed different caches depending on what scheme was used.

Note: Since Varnish doesn’t support HTTPS, it is in this case placed behind Nginx. Nginx then indicates any HTTPS requests passed onto by setting the X-Forwarded-Proto header.

With Varnish handling caching, this is what needed to be added to the configuration:

I’m a webdeveloper based in Oslo, Norway. I currently work with web development at Nettmaker.

I would like to change the world, but they won’t give me the source…