spatie/laravel-varnish

Why not s-maxage?

dvershinin opened this issue · 2 comments

Disclaimer: I haven't used the package, but merely checked its code here.

You're using max-age, however, this dictates caching policy to both Varnish and browsers.

It makes much more sense to use s-maxage for Varnish cache policy, as it fully supports it.

Why: in a typical scenario, when you make something cacheable on Varnish for a long time, you don't want to
have it cached for a long time in clients. You configure something like s-maxage=<high>, max-age=0 and PURGE content in Varnish upon updates (e.g. in admin). In that way, clients benefit from Varnish caching without seeing stale data.

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.