diff options
| author | Matthew Landauer <matthew@openaustralia.org> | 2013-02-18 15:13:57 +1100 | 
|---|---|---|
| committer | Matthew Landauer <matthew@openaustralia.org> | 2013-02-18 15:13:57 +1100 | 
| commit | 521122ea8611de83b9ba8df3b091f9c4f38c3676 (patch) | |
| tree | 31f505e1e4db33f0c7aa9666568b2250040b48b7 | |
| parent | 2e2fb249527ab23ae45a738cd84c4910b1b3a5f0 (diff) | |
Add varnish configuration for caching http and https requests differently
| -rw-r--r-- | config/varnish-alaveteli.vcl | 40 | 
1 files changed, 40 insertions, 0 deletions
diff --git a/config/varnish-alaveteli.vcl b/config/varnish-alaveteli.vcl index 77350a8c8..5dd0ac83c 100644 --- a/config/varnish-alaveteli.vcl +++ b/config/varnish-alaveteli.vcl @@ -115,3 +115,43 @@ sub vcl_fetch {      }  } +# We need to separately cache requests originating via http and via https +# since we are serving very slightly different content in each case + +# Varnish 2.x version of vcl_hash +#sub vcl_hash { +#    set req.hash += req.url; +#    if (req.http.host) { +#        set req.hash += req.http.host; +#    } else { +#        set req.hash += server.ip; +#    } +# +#    # Include the X-Forward-Proto header, since we want to treat HTTPS +#    # requests differently, and make sure this header is always passed +#    # properly to the backend server. +#    if (req.http.X-Forwarded-Proto) { +#        set req.hash += req.http.X-Forwarded-Proto; +#    } +# +#    return (hash); +#} + +# Varnish 3 version of vcl_hash +sub vcl_hash { +    hash_data(req.url); +    if (req.http.host) { +        hash_data(req.http.host); +    } else { +        hash_data(server.ip); +    } + +    # Include the X-Forward-Proto header, since we want to treat HTTPS +    # requests differently, and make sure this header is always passed +    # properly to the backend server. +    if (req.http.X-Forwarded-Proto) { +        hash_data(req.http.X-Forwarded-Proto); +    } + +    return (hash); +}  | 
