Syntax error with skip_cache_uri

For WooCommerce, skip_cache_ui and skip_cache_cookie should be configured:

cache:
      enabled: true
      # Skip cache for some WooCommerce üages
      skip_cache_uri: /wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml|* "/store.*|/cart.*|/my-account.*|/checkout.*|/addons.*
      skip_cache_cookie: comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|woocommerce_cart_hash|woocommerce_items_in_cart|wp_woocommerce_session_

However, during playbook apply nginx reload fails because of configuration error:

 nginx: [emerg] unexpected "/" in /etc/nginx/sites-enabled/example.com.conf:27

Which is this line in nginx config:

 if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml|* "/store.*|/cart.*|/my-account.*|/checkout.*|/addons.*") {

Why does this line have a double quote after (_index)?.xml|*?

 skip_cache_uri: /wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml|* "/store.*|/cart.*|/my-account.*|/checkout.*|/addons.*

I think that quote is breaking the parsing of that line. For reference, in my group_vars/production/wordpress_sites.yml that line looks like this:

skip_cache_uri: /wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml|/store.*|/shop.*|/cart.*|/my-account.*|/checkout.*|/addons.*
3 Likes