Bug 55192 - htaccess error messages missing request context
Summary: htaccess error messages missing request context
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Core (show other bugs)
Version: 2.5-HEAD
Hardware: All All
: P2 trivial (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2013-07-03 13:53 UTC by Dave
Modified: 2013-10-04 20:26 UTC (History)
0 users



Attachments
Make request_rec information available to htaccess error logging (3.27 KB, patch)
2013-07-03 13:53 UTC, Dave
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dave 2013-07-03 13:53:00 UTC
Created attachment 30531 [details]
Make request_rec information available to htaccess error logging

Error logging for .htaccess is missing request information.

This information is not available to ErrorLogFormat as the request_rec is not passed in (for example, on vhost aliasing, %V cannot find the request host and so makes determining where an error was generated impossible)

As part of the changes for PR 52439, the very common .htaccess errors AH02295 and AH02296 are now logged locally inside invoke_cmd and ap_walk_config_sub. Since no associated request_rec is available, these are logged using ap_log_perror().

One possible solution is to add the request_rec to cmd_parms and use ap_log_rerror() when available. However, as this changes the API it may not be desirable. I've attached a rough patch demonstrating this workaround.

Example:

ErrorLogFormat "%-V [%{c}t] [%-m:%l] %7F: %E: [client\ %a] %M% ,\ referer\ %{Referer}i""

Before:

- [2013-07-03 00:46:02] [core:warn] AH02295: Options in .htaccess forbidden by AllowOverride

After:

somedomain.com [2013-07-03 14:47:56] [core:warn] [client X.X.X.X:Y] AH02295: Options in .htaccess forbidden by AllowOverride, referer http://somedomain.com/somefile.html