Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc096852

Browse files
TomiSweaverryan
authored andcommitted
Varnish configuration to ensure routing works
1 parentc471fc7 commitc096852

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

‎cookbook/cache/varnish.rst‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,5 +176,23 @@ that will invalidate the cache for a given resource:
176176
}
177177
}
178178
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.
196+
179197
.. _`Edge Architecture`:http://www.w3.org/TR/edge-arch
180198
.. _`GZIP and Varnish`:https://www.varnish-cache.org/docs/3.0/phk/gzip.html

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp