Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
Using the Drupal Commerce, when added a product to cart in the product display page, The status message saying "Product X added to cart" isn't displayed only if I refresh the page.
I think is because the Nginx microcache.
Comments
Comment #2
memtkmcc CreditAttribution: memtkmcc at Omega8.cc commentedWe have a giant global.inc file in BOA to handle all exceptions like this.
Not sure if we should incorporate some of them in Aegir directly, if Nginx with microcaching is used?
Note that you could also add in your affected site's
local.settings.php
this snippet:You could do the same for all POST and AJAX requests, and in BOA we even set special cookie when visitor submits a form, adds an item to the cart, etc, to prevent Nginx from displaying a cached page.
Comment #3
memtkmcc CreditAttribution: memtkmcc at Omega8.cc commentedComment #4
millenniumtreeI've actually seen microcaching cause more issues than it's intended to solve.
Here are some pros and cons of microcaching:
Pro:
Prevent anonymous users/bots from crushing your server by accessing the same page thousands of times.
Con:
Caches pages for anonymous and non-anonymous users that Drupal doesn't want cached. "fastcgi_ignore_headers Cache-Control Expires;", I'm looking at you.
Con:
Does NOTHING about bots hitting thousands of unique pages across your site. Each unique path will be faithfully served, cached, uncached after 10 seconds, while your server load spikes.
Con:
Does nothing about authenticated users or users that have submitted a form (w/ cookie_cache_bypass) hitting the site thousands of times. We have actually had the server load driven into the 100+ range because a site admin held down the F5 key after logging in. A cat could take your server down.
Con:
Overrides Drupal cache lifetimes - if you want pages cached for a day, you still only get 10 seconds.
Partial solutions and caveats:
Should we explore some new concepts for caching and configuration?
Comment #5
memtkmcc CreditAttribution: memtkmcc at Omega8.cc commentedI agree that the way it's implemented in a vanilla Aegir currently is problematic. I think it was added in the past without fully realizing that it needs more complete approach to be actually useful, as we do it in BOA for years.
BOA fixes all cons you have listed, and comes with far more advanced capabilities, like ability to configure custom settings and/or overrides per site or per platform, on the fly, via site and platform INI files, which are interpreted in the logic we have in the global.inc
BOA also supports extra Nginx overrides/includes, if needed. Note that you can't use the map directive there, because it's accepted only in the higher http config context.
We could perhaps look into possibility to backport some BOA solutions, although not everything could be directly backported. For example, we are using a custom Perl and Bash monitoring scripts integrated with CSF firewall for automatic DoS and system load protection, on the Nginx level.
Comment #6
fall_0ut CreditAttribution: fall_0ut at Openquest commented