I want to set headers as array(\'Cache-Control\'=>\'no-cache, no-store, max-age=0, must-revalidate\',\'Pragma\'=>\'no-cache\',\'Expires\'=>\'Fri, 01 Jan 1990
Working on Laravel 4.2. I'm using filter for this, so in filters.php i have:
Route::filter('no-cache',function($route, $request, $response){
$response->header("Cache-Control","no-cache,no-store, must-revalidate");
$response->header("Pragma", "no-cache"); //HTTP 1.0
$response->header("Expires"," Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
});
Than I attach this filter to routes or controllers. Controller attached looks like this for me:
public function __construct() {
$this->beforeFilter('onestep',array('except' => 'getLogin'));
$this->beforeFilter('csrf',array('on' => 'post'));
$this->afterFilter("no-cache", ["only"=>"getIndex"]);
}
This filter is attached as afterFilter.