aboutsummaryrefslogtreecommitdiffstats
path: root/config/varnish-alaveteli.vcl
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-03-12 09:46:31 -0700
committerLouise Crow <louise.crow@gmail.com>2013-03-12 09:46:31 -0700
commitbf6fc976fb29adbc8d46336d3d010c99effcaef0 (patch)
tree4e74742f2806d06f0888e2a327c7dd0494986c9e /config/varnish-alaveteli.vcl
parent0735585de2d037e3b7495d701f2f2e199f483889 (diff)
parent334769f7f261773d9c07a1b92c811ef588dd10b2 (diff)
Merge remote-tracking branch 'openaustralia_github/force-ssl' into develop
Conflicts: Gemfile.lock
Diffstat (limited to 'config/varnish-alaveteli.vcl')
-rw-r--r--config/varnish-alaveteli.vcl40
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);
+}