4 years ago

Set custom header for any response

Posted 4 years ago by raphael

I would like to set a header like "Cache-Control: no-cache, must-revalidate" for any view response in my application.

Currently, I'm returning view responses from Controllers like this: return view('users.index'); Using this, the Cache-Control header says "no-cache".

In the documentation I found how to define Response Macros which can be re-used for many responses. (http://laravel.com/docs/5.1/responses#response-macros)

But I want to add the header to any view()-call.

How can I make this work in an easy way?

Please sign in or create an account to participate in this conversation.