File tree Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -57,14 +57,11 @@ Symfony adds automatically:
57
57
.. code-block :: text
58
58
59
59
sub vcl_fetch {
60
- /*
61
- Check for ESI acknowledgement
62
- and remove Surrogate-Control header
63
- */
60
+ // Check for ESI acknowledgement and remove Surrogate-Control header
64
61
if (beresp.http.Surrogate-Control ~ "ESI/1.0") {
65
62
unset beresp.http.Surrogate-Control;
66
63
67
- // For Varnish >= 3.0
64
+ // For Varnish >= 3.0, < 4.0
68
65
set beresp.do_esi = true;
69
66
// For Varnish < 3.0
70
67
// esi;
@@ -79,6 +76,24 @@ Symfony adds automatically:
79
76
}
80
77
}
81
78
79
+ /* For Varnish >= 4.0
80
+ (https://www.varnish-cache.org/docs/4.0/whats-new/upgrading.html#req-not-available-in-vcl-backend-response) */
81
+ sub vcl_backend_response {
82
+ // Check for ESI acknowledgement and remove Surrogate-Control header
83
+ if (beresp.http.Surrogate-Control ~ "ESI/1.0") {
84
+ unset beresp.http.Surrogate-Control;
85
+
86
+ set beresp.do_esi = true;
87
+ }
88
+ if (beresp.http.Pragma ~ "no-cache" ||
89
+ beresp.http.Cache-Control ~ "no-cache" ||
90
+ beresp.http.Cache-Control ~ "private") {
91
+ // https://www.varnish-cache.org/docs/4.0/whats-new/upgrading.html#hit-for-pass-objects-are-created-using-beresp-uncacheable
92
+ set beresp.uncacheable = true;
93
+ return (deliver);
94
+ }
95
+ }
96
+
82
97
.. caution ::
83
98
84
99
Compression with ESI was not supported in Varnish until version 3.0
You can’t perform that action at this time.
0 commit comments