hook_boot and Varnish
سؤال
I have a module that implements a hook_boot(), and it checks if user is going to access home page and if user does not have a specific cookie. If both verifications are true, it redirects user to a /welcome page and set cookie. So the second time a user tries to access home page, it will see that user has the cookie and will not redirect.
Recently, I installed Varnish on my site, and everytime I try to access home page, I get to /welcome page. It never skips.
I'm not sure but it looks like the first time I access home page, when I still don't have cookie, it caches the home page, shows /welcome page and set cookie. Then, second time I try to access home, it gets the cached page (which thinks I don't have cookie) and redirect again to /welcome page, even though I have cookie.
I tried not caching home page but it didn't work.
Any thoughts?
لا يوجد حل صحيح