Bug #2908
closedmod_rewrite now throws error ENDLESS LOOP IN rewrite-rule DETECTED
Description
Problem seen since upgrading to version 1.4.50.
Version 1.4.49 is NOT affected, using same config.
URL to test (static file):
www.domain.tld/wp-content/uploads/2014/06/sample-29.png?id=623
ERROR shown at logs:
(mod_rewrite.c.243) ENDLESS LOOP IN rewrite-rule DETECTED ... aborting request, perhaps you want to use url.rewrite-once instead of url.rewrite-repeat
Config using "url.rewrite-if-not-file" (NO other mod_rewrite rules for the host)
url.rewrite-if-not-file = ("^/wp-content/cache/minify/(.+\.(css|js))$" => "/wp-content/plugins/w3-total-cache/pub/minify.php?file=$1") url.rewrite-if-not-file += ( "^/(forums|wp-admin|wp-includes|wp-content|storage)/(.*)" => "$0", "^/wp-admin$" => "$0", "^/(sitemap\.xml|sitemap\.xml\.gz)" => "$0", "^/(.*\.php)" => "$0", "^/(.*)$" => "/index.php/$1" )
Changing "rewrite-if-not-file" to be "url.rewrite-once" works, but suspecting something weird is happening since it was working before (so breaking change..) and the log message about not using "url.rewrite-repeat"
Updated by gstrauss over 6 years ago
- Status changed from New to Patch Pending
- Target version changed from 1.4.x to 1.4.51
ick. Looks like I messed up some indexes for url.rewrite-repeat and url.rewrite-if-not-file. Please try this patch:
--- a/src/mod_rewrite.c +++ b/src/mod_rewrite.c @@ -196,11 +196,11 @@ static int mod_rewrite_patch_connection(server *srv, connection *con, plugin_dat } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("url.rewrite-repeat"))) { PATCH(rewrite); p->conf.context = dc; - PATCH(rewrite_NF_repeat_idx); + PATCH(rewrite_repeat_idx); } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("url.rewrite-if-not-file"))) { PATCH(rewrite_NF); p->conf.context_NF = dc; - PATCH(rewrite_repeat_idx); + PATCH(rewrite_NF_repeat_idx); } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("url.rewrite-repeat-if-not-file"))) { PATCH(rewrite_NF); p->conf.context_NF = dc;
Updated by juangacovas over 6 years ago
gstrauss wrote:
ick. Looks like I messed up some indexes for url.rewrite-repeat and url.rewrite-if-not-file.
Please try this patch:
Tried the patch and it works. Thanks!
Updated by gstrauss about 6 years ago
- Status changed from Patch Pending to Fixed
- % Done changed from 0 to 100
Applied in changeset 2eabe1636c30fc064440dd415861a3961a7495a7.
Also available in: Atom