https://bz.apache.org/bugzilla/show_bug.cgi?id=64117

            Bug ID: 64117
           Summary: Apache is not logging original URL %<U or original
                    query %<q when using RewriteEngine
           Product: Apache httpd-2
           Version: 2.4.41
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_log_config
          Assignee: bugs@httpd.apache.org
          Reporter: re...@seznam.cz
  Target Milestone: ---

Hello,
when using RewriteEngine it seems that the original URL path of the request
(%<U) is not logged. 

Tested on apache 2.4.6 present in RHEL7 and 2.4.41 in Fedora 31.

No matter if I use %U or %<U or %>U in the LogFormat, the output written to the
log file is always containing the url after rewriting. Same applies for the
query string (%q %<q %>q).

According the documentation
http://httpd.apache.org/docs/current/mod/mod_log_config.html it should be
possible to use "<" and ">" modifiers to distinguish between original and final
value, but it doesn't work for %<U and %<q when using the RewriteEngine. The
only formatting string which holds the original URL seems to be %r.

For example having application, which redirects all URL and query parameters to
handler index.php :
    RewriteEngine On    # Turn on the rewriting engine
    #===== Pass requests for nonexisting files to index.php
    RewriteCond "/var/www/html/%{REQUEST_FILENAME}" !-f
    RewriteRule "(.*)" "/index.php?path=$1" [PT,QSA]

So user requesting http://test.com/hello/world?param1=value1 will be actually
processed by http://test.com/index.ph?path=/hello/world&param1=value1 

I would like to log Custom log with the original URL, but it doesn't work ...
for example:
LogFormat "%h %l %u %t \"%m http://%{Host}i%<U%<q %H\" %>s %b" common_full_url 


Best regards
Michal Ambroz

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscr...@httpd.apache.org
For additional commands, e-mail: bugs-h...@httpd.apache.org

Reply via email to