[prev in list] [next in list] [prev in thread] [next in thread]
List: varnish-commit
Subject: [master] 6b52421 Set a better example in the docs
From: Dridi Boukelmoune <dridi.boukelmoune () gmail ! com>
Date: 2016-11-30 16:01:05
Message-ID: E1cC7Jh-00062G-AU () project ! varnish-software ! com
[Download RAW message or body]
commit 6b5242150f3e0a485c8e83d1fe1c4491acdc8105
Author: Dridi Boukelmoune <dridi.boukelmoune@gmail.com>
Date: Wed Nov 30 15:14:03 2016 +0100
Set a better example in the docs
Adapted from an original patch from @michbsd: on top of normalizing the
host header we now have a regular expressions that only match the right
domains and potential sub-domains.
Closes #2140
diff --git a/doc/sphinx/users-guide/vcl-separate.rst b/doc/sphinx/users-guide/vcl-separate.rst
index 67c9727..031807c 100644
--- a/doc/sphinx/users-guide/vcl-separate.rst
+++ b/doc/sphinx/users-guide/vcl-separate.rst
@@ -28,14 +28,19 @@ Next we write the top-level VCL program, which branches out
to the other two, depending on the Host: header in the
request::
- /* We have to have a backend, even if we do not use it */
+ import std;
+
+ # We have to have a backend, even if we do not use it
backend default { .host = "127.0.0.1"; }
sub vcl_recv {
- if (req.http.host ~ "varnish.org$") {
+ # Normalize host header
+ set req.http.host = std.tolower(req.http.host);
+
+ if (req.http.host ~ "\.?varnish\.org$") {
return (vcl(l_vo));
}
- if (req.http.host ~ "varnish-cache.org$") {
+ if (req.http.host ~ "\.?varnish-cache\.org$") {
return (vcl(l_vc));
}
return (synth(302, "http://varnish-cache.org"));
_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic