gpt4 book ai didi

caching - Symfony2 响应 - 清除后退按钮上的缓存 header

转载 作者:行者123 更新时间:2023-12-04 14:14:52 24 4
gpt4 key购买 nike

按下后退按钮时,我在清除缓存时遇到问题。

我的标题信息说我不是从缓存加载的:

Status Code:200 OK (from cache)

我的回复设置为:
$response = new Response;
$response->expire();
$response->headers->addCacheControlDirective('must-revalidate', true);
$response->headers->addCacheControlDirective('allow_reload', true);

我究竟做错了什么?所有文档方法似乎都不起作用......

最佳答案

接受来自 this article 的建议并设置列出的 Cache-Control 指令对我有用 - 通过按后退按钮向服务器发送请求。

$response->headers->addCacheControlDirective('no-cache', true);
$response->headers->addCacheControlDirective('max-age', 0);
$response->headers->addCacheControlDirective('must-revalidate', true);
$response->headers->addCacheControlDirective('no-store', true);

关于caching - Symfony2 响应 - 清除后退按钮上的缓存 header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15717906/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com