Question

Im trying to use esi to make a ninja caching on my site. The idea is, the site is mostly static, I just need to do fancy stuff if the user is logged in or not. So I was trying to put an on the page A, and set triggers in the application at page B.

This way I could cache the page A on varnish, and let the server deal with the small work that is page B.

But the cookies I've seted on page B were not forwarded to headers of page A and didn't work =/

Is this that Im trying to do possible?

I could use ajax, but doing this inside the server, before sending the page to the user seems more correct to me.

ps: I can't create an esi tag =/

Was it helpful?

Solution

You can't set cookies via an esi include because esi's are requested by varnish and not by the client.

What you can do is include a javascript tag or tracking pixel via ESI and then set your cookies that way. Or you could reverse what you're doing, make your main webserver request set cookies and do your user stuff then include an ESI to get the content which doesn't need cookies.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top