how can i create a sort-of last response middleware on a Laravel application that checks if the response does not contain any userland-generated data like, for example, authentication data?
I've seen that a standard Cookie contains the following keys:
_token
_csrf
_previous
_redirect
_flash
PHPDEBUGBAR_STACK_DATA
-- This is injected by barryvdh/laravel-debugbar
Why would I need this? Because I need Varnish to reply from cache, if the request is stateless. In other words, Users that just want to navigate the (20000+) static pages of the website.
My goal is to have a final middleware that physically forces the response stack to not send any set-cookie header, if there is no need of setting it (not-authed user).