From 6038a9b2605af5da4f772cb6909610bd327c94e9 Mon Sep 17 00:00:00 2001 From: TomiS Date: Thu, 25 Jul 2013 11:15:56 +0300 Subject: [PATCH 1/6] Varnish configuration to ensure routing works --- cookbook/cache/varnish.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/cookbook/cache/varnish.rst b/cookbook/cache/varnish.rst index e461e3124ee..0fbf0bf3825 100644 --- a/cookbook/cache/varnish.rst +++ b/cookbook/cache/varnish.rst @@ -176,5 +176,23 @@ that will invalidate the cache for a given resource: } } +Routing +------------------ +To ensure Symfony Router generates urls correctly with Varnish, proper ```X-Forwarded``` headers must be added. Headers depend on how you have configured hosts and ports for the web server and Varnish but this example should work if the web server is using the same IP as Varnish but different port (e.g. 8080). + +.. code-block:: text + + sub vcl_recv { + if (req.http.X-Forwarded-Proto == "https" ) { + set req.http.X-Forwarded-Port = "443"; + } else { + set req.http.X-Forwarded-Port = "80"; + } + } + +.. note:: + + Remember to set framework.trust_proxy_headers: true for this to work. + .. _`Edge Architecture`: http://www.w3.org/TR/edge-arch .. _`GZIP and Varnish`: https://www.varnish-cache.org/docs/3.0/phk/gzip.html From ed7ebbaaa05b3400a6fb42345f859ecd5ebbd43a Mon Sep 17 00:00:00 2001 From: TomiS Date: Thu, 25 Jul 2013 11:19:46 +0300 Subject: [PATCH 2/6] Try to fix intendation --- cookbook/cache/varnish.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cookbook/cache/varnish.rst b/cookbook/cache/varnish.rst index 0fbf0bf3825..634f248e148 100644 --- a/cookbook/cache/varnish.rst +++ b/cookbook/cache/varnish.rst @@ -183,12 +183,12 @@ To ensure Symfony Router generates urls correctly with Varnish, proper ```X-Forw .. code-block:: text sub vcl_recv { - if (req.http.X-Forwarded-Proto == "https" ) { - set req.http.X-Forwarded-Port = "443"; - } else { - set req.http.X-Forwarded-Port = "80"; - } - } + if (req.http.X-Forwarded-Proto == "https" ) { + set req.http.X-Forwarded-Port = "443"; + } else { + set req.http.X-Forwarded-Port = "80" + } + } .. note:: From 594dcbd7a6d9c8acebf621a302e45c14e3920d57 Mon Sep 17 00:00:00 2001 From: TomiS Date: Thu, 25 Jul 2013 11:24:26 +0300 Subject: [PATCH 3/6] a bit more --- cookbook/cache/varnish.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/cache/varnish.rst b/cookbook/cache/varnish.rst index 634f248e148..911995b086a 100644 --- a/cookbook/cache/varnish.rst +++ b/cookbook/cache/varnish.rst @@ -192,7 +192,7 @@ To ensure Symfony Router generates urls correctly with Varnish, proper ```X-Forw .. note:: - Remember to set framework.trust_proxy_headers: true for this to work. + Remember to set framework.trust_proxy_headers: true in Symfony configuration for this to work. .. _`Edge Architecture`: http://www.w3.org/TR/edge-arch .. _`GZIP and Varnish`: https://www.varnish-cache.org/docs/3.0/phk/gzip.html From d5b042e8866dba06ab5a1d6d0fea540d97c5d53b Mon Sep 17 00:00:00 2001 From: TomiS Date: Thu, 25 Jul 2013 13:27:09 +0300 Subject: [PATCH 4/6] fix typos --- cookbook/cache/varnish.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cookbook/cache/varnish.rst b/cookbook/cache/varnish.rst index 911995b086a..3013233975c 100644 --- a/cookbook/cache/varnish.rst +++ b/cookbook/cache/varnish.rst @@ -178,7 +178,8 @@ that will invalidate the cache for a given resource: Routing ------------------ -To ensure Symfony Router generates urls correctly with Varnish, proper ```X-Forwarded``` headers must be added. Headers depend on how you have configured hosts and ports for the web server and Varnish but this example should work if the web server is using the same IP as Varnish but different port (e.g. 8080). + +To ensure that the Symfony Router generates urls correctly with Varnish, proper ```X-Forwarded``` headers must be added. Headers depend on how you have configured hosts and ports for the web server and Varnish but this example should work if the web server is using the same IP as Varnish but a different port (e.g. 8080). .. code-block:: text @@ -192,7 +193,8 @@ To ensure Symfony Router generates urls correctly with Varnish, proper ```X-Forw .. note:: - Remember to set framework.trust_proxy_headers: true in Symfony configuration for this to work. + Remember to set framework.trust_proxy_headers: true in the Symfony configuration for this to work. .. _`Edge Architecture`: http://www.w3.org/TR/edge-arch .. _`GZIP and Varnish`: https://www.varnish-cache.org/docs/3.0/phk/gzip.html + From 2c72a47e362392f9dfaa46fdd4b0bcecf379222b Mon Sep 17 00:00:00 2001 From: TomiS Date: Fri, 26 Jul 2013 10:27:00 +0300 Subject: [PATCH 5/6] whitespace characters and line feeds --- cookbook/cache/varnish.rst | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/cookbook/cache/varnish.rst b/cookbook/cache/varnish.rst index 3013233975c..f85be6875be 100644 --- a/cookbook/cache/varnish.rst +++ b/cookbook/cache/varnish.rst @@ -179,22 +179,26 @@ that will invalidate the cache for a given resource: Routing ------------------ -To ensure that the Symfony Router generates urls correctly with Varnish, proper ```X-Forwarded``` headers must be added. Headers depend on how you have configured hosts and ports for the web server and Varnish but this example should work if the web server is using the same IP as Varnish but a different port (e.g. 8080). +To ensure that the Symfony Router generates urls correctly with Varnish, +proper ```X-Forwarded``` headers must be added. Headers depend on how you +have configured hosts and ports for the web server and Varnish but this +example should work if the web server is using the same IP as Varnish but +a different port (e.g. 8080). .. code-block:: text - sub vcl_recv { - if (req.http.X-Forwarded-Proto == "https" ) { - set req.http.X-Forwarded-Port = "443"; - } else { - set req.http.X-Forwarded-Port = "80" - } - } + sub vcl_recv { + if (req.http.X-Forwarded-Proto == "https" ) { + set req.http.X-Forwarded-Port = "443"; + } else { + set req.http.X-Forwarded-Port = "80" + } + } .. note:: - Remember to set framework.trust_proxy_headers: true in the Symfony configuration for this to work. + Remember to set framework.trust_proxy_headers: true in the Symfony + configuration for this to work. .. _`Edge Architecture`: http://www.w3.org/TR/edge-arch .. _`GZIP and Varnish`: https://www.varnish-cache.org/docs/3.0/phk/gzip.html - From 0aeb5470d1be35fde473f0773a0fda2bef5d6c33 Mon Sep 17 00:00:00 2001 From: TomiS Date: Fri, 26 Jul 2013 11:35:16 +0300 Subject: [PATCH 6/6] double backticks --- cookbook/cache/varnish.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/cache/varnish.rst b/cookbook/cache/varnish.rst index f85be6875be..0ad665ca938 100644 --- a/cookbook/cache/varnish.rst +++ b/cookbook/cache/varnish.rst @@ -197,7 +197,7 @@ a different port (e.g. 8080). .. note:: - Remember to set framework.trust_proxy_headers: true in the Symfony + Remember to set ``framework.trust_proxy_headers: true`` in the Symfony configuration for this to work. .. _`Edge Architecture`: http://www.w3.org/TR/edge-arch