66namespace Magento \PageCache \Model \App \FrontController ;
77
88use Magento \Framework \App \Response \Http as ResponseHttp ;
9+ use Magento \Customer \Model \Session ;
910
1011/**
1112 * Plugin for processing builtin cache
@@ -32,24 +33,40 @@ class BuiltinPlugin
3233 */
3334 protected $ state ;
3435
36+ /**
37+ * @var ResponseHttp
38+ */
39+ protected $ responseHttp ;
40+
41+ /**
42+ * @var Session
43+ */
44+ private $ session ;
45+
3546 /**
3647 * Constructor
3748 *
3849 * @param \Magento\PageCache\Model\Config $config
3950 * @param \Magento\Framework\App\PageCache\Version $version
4051 * @param \Magento\Framework\App\PageCache\Kernel $kernel
4152 * @param \Magento\Framework\App\State $state
53+ * @param ResponseHttp $responseHttp
54+ * @param Session $session
4255 */
4356 public function __construct (
4457 \Magento \PageCache \Model \Config $ config ,
4558 \Magento \Framework \App \PageCache \Version $ version ,
4659 \Magento \Framework \App \PageCache \Kernel $ kernel ,
47- \Magento \Framework \App \State $ state
60+ \Magento \Framework \App \State $ state ,
61+ ResponseHttp $ responseHttp ,
62+ Session $ session
4863 ) {
4964 $ this ->config = $ config ;
5065 $ this ->version = $ version ;
5166 $ this ->kernel = $ kernel ;
5267 $ this ->state = $ state ;
68+ $ this ->responseHttp = $ responseHttp ;
69+ $ this ->session = $ session ;
5370 }
5471
5572 /**
@@ -66,6 +83,9 @@ public function aroundDispatch(
6683 \Closure $ proceed ,
6784 \Magento \Framework \App \RequestInterface $ request
6885 ) {
86+ if (!$ this ->session ->getCustomerId ()) {
87+ $ this ->responseHttp ->sendVary ();
88+ }
6989 $ this ->version ->process ();
7090 if (!$ this ->config ->isEnabled () || $ this ->config ->getType () !== \Magento \PageCache \Model \Config::BUILT_IN ) {
7191 return $ proceed ($ request );
0 commit comments