Project

General

Profile

Bug #2908

mod_rewrite now throws error ENDLESS LOOP IN rewrite-rule DETECTED

Added by juangacovas 2 months ago. Updated about 2 months ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
mod_rewrite
Target version:
Start date:
2018-09-10
Due date:
% Done:

100%

Estimated time:
Missing in 1.5.x:

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"

Associated revisions

Revision 2eabe163 (diff)
Added by gstrauss about 2 months ago

[mod_rewrite] fix url.rewrite-repeat and url.rewrite-if-not-file (fixes #2908)

regression in lighttpd 1.4.50

x-ref:
"mod_rewrite now throws error ENDLESS LOOP IN rewrite-rule DETECTED"
https://redmine.lighttpd.net/issues/2908

History

#1

Updated by gstrauss 2 months 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;
#2

Updated by juangacovas 2 months 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!

#3

Updated by gstrauss about 2 months ago

  • Status changed from Patch Pending to Fixed
  • % Done changed from 0 to 100

Also available in: Atom