Score:0

Varnish caching issue in the 'Add to cart' section ,,, Drupal,Nginx,Php-Fpm

eg flag

We are running an ecommerce site configured by drupal with nginx & php-fpm. We also use memcached with mysql database.The service was running smoothly before we enabled the varnish caching. After enabling the varnish we are getting better performance but also facing a session related issue when accessing the "add to cart" section. We have bypassed the urls related to "add to cart" from varnish but still no luck.

The issue is described below When we add any product to cart for purchase we can see the count number on the "add to cart" section but if the page refreshes and served by the varnish then the count number resets to zero and after that the cart became empty.

Now, which configuration need to be set on varnish to resolve the issue, so that we can use varnish caching on the system?

Varnish conf:

Varnish conf

Nginx Conf:

Nginx conf

sv flag
Shows us the current configuration of varnish and nginx.
Md. Shahriar Hossain avatar
eg flag
Yeap, here you go,, added in the post
Thijs Feryn avatar
in flag
Is the shopping cart section of the website loaded via AJAX or ESI? Or is it all part of the same `/shop` HTTP response? If AJAX or ESI is used, can you please describe how the shopping cart count is loaded and via which URL?
Md. Shahriar Hossain avatar
eg flag
@ThijsFeryn shopping cart section of the website loaded via AJAX,,, shopping cart count loaded via ajax, ajax return all html required for cart item
Thijs Feryn avatar
in flag
@Md.ShahriarHossain Can you give me the exact URL of the AJAX call. I'll use this to compose a logging command. This will be part of the answer I will create for you.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.