Greetings,

A stupid config example to make my point :

Loglevel debug
RewriteEngine On
RewriteRule .* - [F]

This denies all requests, and logs nothing at all in error log to explain that behavior. This is contrary to a common Apache behavior about all non 2XX answers triggering an explanation message in error log. For instance, "deny from all" does.

It means people need to set RewriteLog stuff to even find out that Rewrite was the source of the 403, which is IMHO bad.

I am therefore submitting this trivial patch against trunk's rewrite.c : all it does is to add an error log entry when rewrite triggers a [F] rule.

I hope someone will kindly apply it, or please bash me :)

Regards,

gryzor

Index: mod_rewrite.c
===================================================================
--- mod_rewrite.c	(révision 819195)
+++ mod_rewrite.c	(copie de travail)
@@ -3460,6 +3460,9 @@
         if (!*key || !strcasecmp(key, "orbidden")) {       /* forbidden */
             cfg->flags |= (RULEFLAG_STATUS | RULEFLAG_NOSUB);
             cfg->forced_responsecode = HTTP_FORBIDDEN;
+            ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+		"client denied by rewrite [F] rule: %s",
+		r->filename ? r->filename : r->uri);
         }
         else {
             ++error;

Reply via email to