第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Magento 2 會話數(shù)據(jù)在 google chrome 中被刪除

Magento 2 會話數(shù)據(jù)在 google chrome 中被刪除

PHP
犯罪嫌疑人X 2023-11-03 20:24:47
問題:當我的 magento2.3 應(yīng)用程序?qū)⒂脩糁囟ㄏ虻街Ц毒W(wǎng)關(guān)時,我可以訪問所有會話數(shù)據(jù)。但是當它從那里返回時,它沒有結(jié)賬會話數(shù)據(jù)或任何會話數(shù)據(jù)。這只發(fā)生在谷歌瀏覽器上我已經(jīng)探索過的事情從 google chrome 發(fā)行說明(https://www.chromium.org/updates/same-site)我可以看到他們已將 Samesite 默認值更改為“ Lax ”,并禁用此功能。解決方案尋找我想為我對任何第三方服務(wù)的所有傳出請求提供Samesite=None值。任何幫助或領(lǐng)導將不勝感激。
查看完整描述

2 回答

?
斯蒂芬大帝

TA貢獻1827條經(jīng)驗 獲得超8個贊

您可以嘗試按照以下步驟設(shè)置Samesite=None 。


文件:etc/frontend/di.xml


<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

    <type name="Magento\Framework\View\Element\Js\Cookie">

        <plugin name="afterGetPath" type="namespace\module\Plugin\View\Element\Js\ManagePath" sortOrder="10"/>

    </type>

</config>

文件:插件/視圖/元素/Js/ManagePath.php


namespace namespace\module\Plugin\View\Element\Js;


use Magento\Framework\View\Element\Js\Cookie;


class ManagePath

{

    public function afterGetPath(\Magento\Framework\View\Element\Js\Cookie $subject, $path)

    {

        

        if (preg_match('/SameSite/', $path)) {

             $path_array = explode(';', $path);

             $path = $path_array[0];

        }

        

        return $path;

    }

}

文件:etc/di.xml


<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">

    <preference for="Magento\Framework\Session\Config\ConfigInterface" type="namespace\module\Session\CustomConfig"/>

</config>


文件:會話/CustomConfig.php



namespace namespace\module\Session;


use Magento\Framework\Session\Config as DefaultConfig;


class CustomConfig extends DefaultConfig

{

    public function setCookiePath($path, $default = null)

    {   

        parent::setCookiePath($path, $default);


        $path = $this->getCookiePath();


        //check and update path of cookie

        if (!preg_match('/SameSite/', $path)) {

            $path .= '; SameSite=None';

            $this->setOption('session.cookie_path', $path);

        }


        return $this;

    }

}


注意:用您的命名空間和模塊替換命名空間和模塊。


查看完整回答
反對 回復(fù) 2023-11-03
?
慕仙森

TA貢獻1827條經(jīng)驗 獲得超8個贊

由于我沒有足夠的聲譽來評論已接受的答案,我必須指出,對我來說它不起作用,因為 Chrome 要求將 SameSite 的所有 cookie 設(shè)置為“無”以標記為安全。修復(fù)添加:

$path .= '; SameSite=None ; secure';

如果不將它們標記為安全,我將無法將商品添加到購物車。

為我工作,希望它能幫助遇到同樣問題的其他人。


查看完整回答
反對 回復(fù) 2023-11-03
  • 2 回答
  • 0 關(guān)注
  • 136 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號