caching anon users', & auth users' ESI, content specifically in Laravel PHP framework apps?

grantksupport at operamail.com grantksupport at operamail.com
Tue Dec 16 21:25:15 CET 2014


I didn't get to ESI yet.

but, what appears to be a clean fix is

in laravel/app/config/app.php

	'driver' => 'redis',  ( in my case; other options are available )

@ laravel site top-dir, install & enable the "Session Monster" service provider

	http://packalyst.com/packages/package/haifanghui/session-monster

That will set a

	X-No-Session: yeah

header when NOT authenticated

Then, in Varnish VCL strip cookies if the header's detected

	...
	sub vcl_backend_response {
		...
		if (beresp.http.X-No-Session ~ "yeah") {
			unset beresp.http.set-cookie;
		}
		...
	...
	sub vcl_deliver {
		...
+		unset resp.X-No-Session; // not required, but cleaner
		...

Now on serving anon pages, there's no cookie, and Varnish caches properly




More information about the varnish-misc mailing list