How to fix “set SameSite cookie to none” warning?

前端 未结 7 1760
生来不讨喜
生来不讨喜 2020-12-04 21:15

I created a chrome extension and from popup.js I called PHP script (Using Xhttprequest) that reads the cookie. Like this:

$cookie_name = \"mycookie\";

if(is         


        
7条回答
  •  庸人自扰
    2020-12-04 21:42

    I ended up fixing our Ubuntu 18.04 / Apache 2.4.29 / PHP 7.2 install for Chrome 80 by installing mod_headers:

    a2enmod headers
    

    Adding the following directive to our Apache VirtualHost configurations:

    Header edit Set-Cookie ^(.*)$ "$1; Secure; SameSite=None"
    

    And restarting Apache:

    service apache2 restart
    

    In reviewing the docs (http://www.balkangreenfoundation.org/manual/en/mod/mod_headers.html) I noticed the "always" condition has certain situations where it does not work from the same pool of response headers. Thus not using "always" is what worked for me with PHP but the docs suggest that if you want to cover all your bases you could add the directive both with and without "always". I have not tested that.

提交回复
热议问题