如何在 OctoberCMS 中设置 Cache-Control HTTP header?

How to set Cache-Control HTTP header in OctoberCMS?

我的应用程序返回所有页面的 Cache-Control: no-cache, private - 我该如何改变这种行为?

P.S.: 这不是 PHP.ini 问题,因为将 session.cache_limiter 更改为 empty/public 不会改变任何内容。

您可以连接一个 event 侦听器来侦听特定事件以设置 headers

 Event::listen('cms.page.display', function ($controller, $url, $page, $result) {
        $headers = [
            'Cache-Control' => 'max-age=2592000, public',
        ];
        return Response::make($result, $controller->getStatusCode(), $headers);
    });