Skip cache URL (localized shop URLs)

The example configuration for skipping WooCommerce-related URLs on Trellis is meant for the default WooCommerce shop page URLs in English language, correct?

When those shop page URLs were localized, e.g. to German (/warenkorb) or restructured (e.g. /shop/cart instead /cart), those URLs must also be listed in skip_cache_uri, correct?

Additionally, (WooCommerce) plugins need to be inspected for additional, custom cookies that need to be listed in skip_cache_cookie.

1 Like

Everything you said is correct :+1:

Is there an easier way to do that?

Now I became a bit OCD whether all paths and cookie names are covered by the cache exclusions. Whitelisting the pages that should be cached appears to be even more tedious than just excluding those that should never be cached. Ideally plugins should offer a list of paths and cookie name patterns that are user-specific and hence should not be cached.
So for now I do not know an easier or better way for finding out those.

1 Like

Out of curiosity, why does trellis ignore Cache-Control headers? trellis/roles/nginx/templates/nginx.conf.j2 at 0aeed2a0a4fdaa3234594210dc350ee09f7d0ccd · roots/trellis · GitHub

If nginx respects it, woocommerce sets it correctly on all relevant page responses and you dont need to find the paths.

With Varnish I set it up to:

  1. respect Cache-Control
  2. skip cache when these cookies are present wordpress_logged_in_|wordpress_sec_|wp-postpass_|wp-resetpass
  3. otherwise cache responses, even with cart cookies since they dont vary page responses (except on cart/checkout/account but they have cache-control: no-cache)
1 Like