You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: cookbook/cache/varnish.rst
+18Lines changed: 18 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -176,5 +176,23 @@ that will invalidate the cache for a given resource:
176
176
}
177
177
}
178
178
179
+
Routing
180
+
------------------
181
+
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).
182
+
183
+
.. code-block:: text
184
+
185
+
sub vcl_recv {
186
+
if (req.http.X-Forwarded-Proto == "https" ) {
187
+
set req.http.X-Forwarded-Port = "443";
188
+
} else {
189
+
set req.http.X-Forwarded-Port = "80";
190
+
}
191
+
}
192
+
193
+
.. note::
194
+
195
+
Remember to set framework.trust_proxy_headers: true for this to work.
0 commit comments