httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [Bug 59426] New: Problem with mod_rewrite, especially with ap_context_document_root()
Date Wed, 04 May 2016 05:46:56 GMT

            Bug ID: 59426
           Summary: Problem with mod_rewrite, especially with
           Product: Apache httpd-2
           Version: 2.4.20
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_rewrite

I have an easy rewrite Rule, which rewrites everything to /index.php, when the
filename or directory doesnt exist.

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Sometimes and really random i become an bad request error 400 back.
After debugging a litte bit i found, that there were changes made with the
"context docroot"

Here are the rewrite logs from an failed and from an working request:
rewrite '2014/tree/' -> '/index.php'
trying to replace prefix
/www/471639_96450/ with /
trying to replace context docroot  with context prefix internal redirect with

rewrite '2014/tree/' -> '/index.php'
trying to replace prefix
/www/471639_96450/ with /
trying to replace context docroot \xa0/\xde\v\xd8/\xde\v\x901\xde\v with
context prefix internal redirect with /index.php [INTERNAL REDIRECT]

It doesnt work, when when ap_context_document_root(r) is empty, but not NULL.
Sometimes it gives me strange docroot folders back like

In 2.4.19 ( i think ) a new option in mod_rewrite was added and i think there
could be an error there:
            /* No base URL, or r->filename wasn't still under dconf->directory
             * or, r->filename wasn't still under the document root.
             * If there's a context document root AND a context prefix, and
             * the context document root is a prefix of r->filename, replace.
             * This allows a relative substitution on a path found by
             * or mod_alias without baking in a RewriteBase.
            if (tmpfilename == r->filename &&
                !(dconf->options & OPTION_IGNORE_CONTEXT_INFO)) {
                if ((ccp = ap_context_document_root(r)) != NULL) {
                    const char *prefix = ap_context_prefix(r);
                    if (prefix != NULL) {
                        rewritelog((r, 2, dconf->directory, "trying to replace
                                    "context docroot %s with context prefix
                                    ccp, prefix));
                        r->filename = subst_prefix_path(r, r->filename,
                                ccp, prefix);

After adding "RewriteOptions IgnoreContextInfo" the random errors are gone.

The setup is a little bit "special". I have an modified mod_vhost_ldap and
The Documentroot, SuexecUserGroup, PHP Version, etc. comes from mod_vhost_ldap
and switches the FastCGI Socket for every domain and php version in the

Yesterday it failed in an bad request about 240 times from 150.000 requests.
Not often, but often enough, so that our customers cry :)

Heres the relevant part of my httpd.conf. mod_http2 isnt enabled, but i can
give it an try

<IfDefine FCGI>
  LoadModule fastcgi_module
  LoadModule vhost_ldap_module

  LDAPSharedCacheSize 2000000
  LDAPCacheEntries 4096
  LDAPCacheTTL 5
  LDAPOpCacheEntries 4096
  LDAPOpCacheTTL 5

  FastCgiExternalServer /etc/httpd/fastcgi/php-fcgi-starter -flush -socket
/etc/httpd/fastcgi/php5-53LATEST -idle-timeout 3600
  Action php-fastcgi /php/php-fcgi-starter


<VirtualHost IP:80>
  ServerName server.hostname
  SuexecUserGroup domcgi nobody
  DocumentRoot /kunden/shadow/htdocs/

   ScriptAlias /php/ /etc/httpd/fastcgi/

    VhostLDAPEnabled on
    VhostLDAPUrl "ldap://localhost/sid=2542,sec=hosting,o=xxxxx,c=de"
    VhostLdapBindDN "cn=readonly,sid=2542,sec=hosting,o=xxxxx,c=de"
    VhostLDAPBindPassword "noone"


You are receiving this mail because:
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message