Bug 55989

Summary: write to error log upon RewriteRule [F]orbidden
Product: Apache httpd-2 Reporter: Viktor Szépe <viktor>
Component: mod_rewriteAssignee: Apache HTTPD Bugs Mailing List <bugs>
Status: REOPENED ---    
Severity: enhancement    
Priority: P2    
Version: 2.2.22   
Target Milestone: ---   
Hardware: All   
OS: Linux   

Description Viktor Szépe 2014-01-11 19:21:53 UTC
Is it possible to write to error log - like mod_authz_host - upon HTTP/403 with RewriteRule?

Thank you!
Comment 1 Eric Covener 2014-01-11 19:27:07 UTC
Bugzilla is for reporting bugs, not support or Q&A.  If you're suggesting an enhancement for 2.2, please reopen and reclassify.
Comment 2 Viktor Szépe 2014-01-11 19:31:19 UTC
Sorry! I know it.
I've just notived recently that fail2ban does not ban RewriteRule [F] requests.

And yes, this is a feature request.
I'd like to have "client denied by server configuration:" - like in mod_authz_host - written to the error log.
Comment 3 Viktor Szépe 2014-10-18 10:11:38 UTC
I think that this is a one-liner in the source code.
Could you please add this error message.
Thank you!
Comment 4 Rainer Jung 2014-10-19 18:03:18 UTC
Using Apache 2.4 you can add custom logging using mod_log_debug.
E.g. set your own env var in the RewriteRule as a side effect and then use mod_log_debug to log your chosen message when the env var is set.

This feature doesn't exist for 2.2 though.

I'm not judging on whether a builtin log statement makes sense w.r.t. consistency with AAA modules.

Regards,

Rainer
Comment 5 Viktor Szépe 2014-10-19 22:19:47 UTC
Thank you for the mod_log_debug suggestion!

I think enabling another module is the last resort.
Comment 6 Viktor Szépe 2014-10-31 22:33:28 UTC
Is it function call needed to write in the error log?
I think is should be in "case 'F':" in mod_rewrite.c.

ap_log_rerror(APLOG_MARK, APLOG_ERR, APR_SUCCESS, r, APLOGNO(01630)
              "client denied by server configuration: %s%s",
              r->filename ? "" : "uri ",
              r->filename ? r->filename : r->uri);