Configuring cookies through ESI: enable, how?

I am trying to use esi to do ninja caching on my site. The idea is that the site is mostly static, I just need to pretend if the user is logged in or not. So I tried to put on page A and set the triggers in the application on page B.

That way I could cache page A on the varnish and let the server handle a little work, which is page B.

But the cookies I set on page B were not redirected to page A headers and did not work = /

Is this what I'm trying to make possible?

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

ps: I cannot create the esi tag = /

+3
ruby-on-rails nginx varnish edge-side-includes
source share
1 answer

You cannot set cookies through esi include because esi is requested by the varnish and not by the client.

What you can do is enable the javascript tag or track the pixel through ESI and then set the cookie this way. Or you can cancel what you are doing, make your main web server request set cookies and make your user materials, and then enable ESI to get content that does not require cookies.

+6
source share

All Articles