My Laravel application is returning Cache-Control: no-cache, private HTTP header by default for each site. How can I change this behaviour?
P.S.: It is
For people that seek a way to write less code, here is another way you can add headers to a response without extra steps.
In the example above, I created a middleware to prevent routes from being cached in the end user browser.
withHeaders([
"Pragma" => "no-cache",
"Expires" => "Fri, 01 Jan 1990 00:00:00 GMT",
"Cache-Control" => "no-cache, must-revalidate, no-store, max-age=0, private",
]);
}
}
Source: Attaching Headers To Responses