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 00:00:00 GMT');
for all my views, currently I'm doing this in all controllers while returning views, like
$headers=array('Cache-Control'=>'no-cache, no-store, max-age=0, must-revalidate','Pragma'=>'no-cache','Expires'=>'Fri, 01 Jan 1990 00:00:00 GMT');
Redirect::to('/',301,$headers);`
So instead of writing this for each and every route can it be done in global scope, so that headers are set for every view.
I tried setting headers by creating after filter, but didn't get it to work.
Can anyone tell me where can I set the headers for all my views?
UPDATE
One of my view file meta content
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>
Now when i use Redirect::to('/',301,$headers)
The header in firebug is
Cache-Control max-age=0, must-revalidate, no-cache, no-store, private
Connection Keep-Alive
Content-Type text/html; charset=UTF-8
Date Tue, 09 Jul 2013 14:52:08 GMT
Expires Fri, 01 Jan 1990 00:00:00 GMT
And when I use Redirect::to('/');
The header in firebug is
Cache-Control no-cache
Connection Keep-Alive
Content-Type text/html; charset=UTF-8
Date Tue, 09 Jul 2013 14:52:08 GMT
See Question&Answers more detail:
os