6
6
namespace Magento \PageCache \Model \App \FrontController ;
7
7
8
8
use Magento \Framework \App \Response \Http as ResponseHttp ;
9
+ use Magento \Customer \Model \Session ;
9
10
10
11
/**
11
12
* Plugin for processing builtin cache
@@ -32,24 +33,40 @@ class BuiltinPlugin
32
33
*/
33
34
protected $ state ;
34
35
36
+ /**
37
+ * @var ResponseHttp
38
+ */
39
+ protected $ responseHttp ;
40
+
41
+ /**
42
+ * @var Session
43
+ */
44
+ private $ session ;
45
+
35
46
/**
36
47
* Constructor
37
48
*
38
49
* @param \Magento\PageCache\Model\Config $config
39
50
* @param \Magento\Framework\App\PageCache\Version $version
40
51
* @param \Magento\Framework\App\PageCache\Kernel $kernel
41
52
* @param \Magento\Framework\App\State $state
53
+ * @param ResponseHttp $responseHttp
54
+ * @param Session $session
42
55
*/
43
56
public function __construct (
44
57
\Magento \PageCache \Model \Config $ config ,
45
58
\Magento \Framework \App \PageCache \Version $ version ,
46
59
\Magento \Framework \App \PageCache \Kernel $ kernel ,
47
- \Magento \Framework \App \State $ state
60
+ \Magento \Framework \App \State $ state ,
61
+ ResponseHttp $ responseHttp ,
62
+ Session $ session
48
63
) {
49
64
$ this ->config = $ config ;
50
65
$ this ->version = $ version ;
51
66
$ this ->kernel = $ kernel ;
52
67
$ this ->state = $ state ;
68
+ $ this ->responseHttp = $ responseHttp ;
69
+ $ this ->session = $ session ;
53
70
}
54
71
55
72
/**
@@ -66,6 +83,9 @@ public function aroundDispatch(
66
83
\Closure $ proceed ,
67
84
\Magento \Framework \App \RequestInterface $ request
68
85
) {
86
+ if (!$ this ->session ->getCustomerId ()) {
87
+ $ this ->responseHttp ->sendVary ();
88
+ }
69
89
$ this ->version ->process ();
70
90
if (!$ this ->config ->isEnabled () || $ this ->config ->getType () !== \Magento \PageCache \Model \Config::BUILT_IN ) {
71
91
return $ proceed ($ request );
0 commit comments