Ad

How To Set Cache-Control HTTP Header In OctoberCMS?

- 1 answer

My application is returning Cache-Control: no-cache, private for all pages - how can I change this behaviour?

P.S.: It is not a PHP.ini problem, because changing session.cache_limiter to empty/public does not change anything.

Ad

Answer

You could hook up an event listener to listen to specific events to set the 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);
    });
Ad
source: stackoverflow.com
Ad