Typo3后台注销后Varnish不缓存 - be_typo3_用户cookie仍然存在

问题描述 投票:2回答:1

我正在使用typo3-9.5.18和varnish-connector扩展。Varnish对前端进行缓存,如果我登录到后端,则不会缓存任何东西。问题是,当我退出后台后,Varnish不会再缓存。我想这是因为cookie 'be_typo3_user',在注销后仍然存在。这个问题类似于BUG #36334,在 https:/forge.typo3.orgissues36334。 ,然而这个解决方案已经7年了。有什么聪明的解决办法吗?

typo3 varnish typo3-9.x
1个回答
2
投票

假设注销的URL是 /logout你可以在Varnish中写一些VCL来帮你删除cookie。

这里有一个VCL片段可以完成这个工作。

sub vcl_backend_response {
    if(bereq.url == "/logout") {
        set beresp.http.set-cookie = "Set-Cookie: be_typo3_user=deleted; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT";
    }
}

你可以把这段VCL添加到你的Varnish服务器上现有的VCL文件中 然后相应地修改匹配的URL.

希望能帮到你。

© www.soinside.com 2019 - 2024. All rights reserved.