Symfony2响应 - 清除后退按钮上的缓存标头

rat*_*m3n 6 caching response cache-control symfony symfony-2.1

我按下后退按钮时清除缓存有问题.

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

Status Code:200 OK (from cache)
Run Code Online (Sandbox Code Playgroud)

我的回答是:

$response = new Response;
$response->expire();
$response->headers->addCacheControlDirective('must-revalidate', true);
$response->headers->addCacheControlDirective('allow_reload', true);
Run Code Online (Sandbox Code Playgroud)

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

gat*_*isl 9

本文中获取建议并设置列出的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);
Run Code Online (Sandbox Code Playgroud)