Setting Headers in Middleware

Posted 1 month ago by TerrePorter

Just curious if something like this is still possible, as its not working.

reference :

In a middleware, this is the code example.

public function handle($request, Closure $next)
        $response = $next($request);

        $response->header('Cache-Control', 'no-cache, must-revalidate');

        return $response;

If i dump the response before returning it, it does contain the headers. But, the headers dont seem to make it to the browser.

Any thoughts?

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

Reply to

Use Markdown with GitHub-flavored code blocks.