Re: 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?

---------------------------------------------------------------------
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