From 8403af51f5ea0455dfc90c0c3c0e2286d9413d46 Mon Sep 17 00:00:00 2001 From: Bob Swinkels Date: Mon, 19 Apr 2021 15:25:28 +0200 Subject: [PATCH 1/2] Fix escaping of regex metacharacters. The map directive contains regexes (strings starting with a tilde) that contain 'dot' characters. In a regex, the dot character is a metacharacter and should be escaped by putting a backslash before it. --- wo/cli/templates/map-wp.mustache | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/wo/cli/templates/map-wp.mustache b/wo/cli/templates/map-wp.mustache index 63b45fa..99e654d 100644 --- a/wo/cli/templates/map-wp.mustache +++ b/wo/cli/templates/map-wp.mustache @@ -28,14 +28,14 @@ map $http_cookie $cookie_no_cache { map $request_uri $uri_no_cache { default 0; "~*/wp-admin/" 1; - "~*/wp-[a-zA-Z0-9-]+.php" 1; + "~*/wp-[a-zA-Z0-9-]+\.php" 1; "~*/feed/" 1; - "~*/index.php" 1; - "~*/[a-z0-9_-]+-sitemap([0-9]+)?.xml" 1; - "~*/sitemap(_index)?.xml" 1; - "~*/wp-comments-popup.php" 1; - "~*/wp-links-opml.php" 1; - "~*/xmlrpc.php" 1; + "~*/index\.php" 1; + "~*/[a-z0-9_-]+-sitemap([0-9]+)?\.xml" 1; + "~*/sitemap(_index)?\.xml" 1; + "~*/wp-comments-popup\.php" 1; + "~*/wp-links-opml\.php" 1; + "~*/xmlrpc\.php" 1; "~*/edd-sl/*" 1; "~*/add_to_cart/" 1; "~*/cart/" 1; From cbe42ab2bb971786e1d14eb79a11f46e9bed9f12 Mon Sep 17 00:00:00 2001 From: Bob Swinkels Date: Mon, 19 Apr 2021 15:36:38 +0200 Subject: [PATCH 2/2] Fix wildcard character in regex strings. The map directive contains regexes (strings starting with a tilde) that contain 'asterisk' characters. In a regex, the asterisk character is a metacharacter, and in this context, it is meant as a wildcard character. To achieve the desired result, we should place a dot in front of the asterisk character. --- wo/cli/templates/map-wp.mustache | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wo/cli/templates/map-wp.mustache b/wo/cli/templates/map-wp.mustache index 99e654d..c7ccc79 100644 --- a/wo/cli/templates/map-wp.mustache +++ b/wo/cli/templates/map-wp.mustache @@ -36,14 +36,14 @@ map $request_uri $uri_no_cache { "~*/wp-comments-popup\.php" 1; "~*/wp-links-opml\.php" 1; "~*/xmlrpc\.php" 1; - "~*/edd-sl/*" 1; + "~*/edd-sl/.*" 1; "~*/add_to_cart/" 1; "~*/cart/" 1; "~*/account/" 1; "~*/my-account/" 1; "~*/checkout/" 1; "~*/addons/" 1; - "~*/wc-api/*" 1; + "~*/wc-api/.*" 1; "~*/logout/" 1; "~*/lost-password/" 1; "~*/panier/" 1;