AW: Problem with mod_rewrite, especially with ap_context_document_root() in apache 2.4.20

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On Tue, May 3, 2016 at 10:17 AM, Daniel Betz <dbetz@xxxxx> wrote:
> > Hello List,
> >
> > i dont know if im right here, or that i should file a bugreport, but i will post
> my problem here first.
> >
> >
> > 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:
> > FAILED:
> > rewrite '2014/tree/' -> '/index.php'
> > trying to replace prefix
> > /www/471639_96450/gn2-
> hosting.de/host260161/host260155/danielbaer.eu/
> > with / trying to replace context docroot  with context prefix internal
> > redirect with index.php [INTERNAL REDIRECT]
> >
> > WORKING:
> > rewrite '2014/tree/' -> '/index.php'
> > trying to replace prefix
> > /www/471639_96450/gn2-
> hosting.de/host260161/host260155/danielbaer.eu/
> > 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
> > \xa0/\xde\v\xd8/\xde\v\x901\xde\v
> >
> > 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 mod_userdir
> >              * 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 %s",
> >                                     ccp, prefix));
> >                         r->filename = subst_prefix_path(r, r->filename,
> >                                 ccp, prefix);
> >                     }
> >                 }
> >             }
> >
> > After adding "RewriteOptions IgnoreContextInfo" the random errors are
> gone.
> >
> > So then. The question is: Bug or Feature and should i file this bug
> somewhere ?
> >
> 
> Bug, but the feature has been in 2.4.x since 2.4.16.  I will take a look at the
> report today.
> 
> I assume this stuff is in your documentroot, no VirtualDocumentRoot or
> Alias used.    How frequently does it fail?    Any chance it requires
> mod_http2?
> 

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

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     mod_fastcgi.so
  LoadModule vhost_ldap_module  mod_vhost_ldap.so

  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


</IfDefine>

<VirtualHost 134.119.246.117:80>
  ServerName m32s4-1-4db.domainfactory.de
  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=xxxx,c=de"
    VhostLDAPBindPassword "noone"
  </IfDefine>


</virtualhost>








---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux