httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ondřej Surý <>
Subject Re: SetVirtualDocumentRoot / per request document root / context root?
Date Mon, 13 Dec 2010 08:33:55 GMT
On Mon, Dec 13, 2010 at 04:15, William A. Rowe Jr. <> wrote:
> On 12/12/2010 4:23 PM, Stefan Fritsch wrote:
>> On Wednesday 10 November 2010, Stefan Fritsch wrote:
>>>> The frequency with which this gets asked seems to make it
>>>> worthwhile doing something, even if this patch isn't the right
>>>> thing to do.
>>> Maybe the larger solution of having a document_root field in the
>>> request_rec would be better. Has anyone had a chance to look at
>>> Ondrej's patch, already? I didn't get around to doing it, yet.
>> I have looked at the patch and it looks reasonable. The fact that two
>> known modules (mod_vhost_ldap and mod_ftp) copy the whole server_rec
>> just to change the document root means that this feature is needed.
>> Well, at least for mod_ftp it is...
>> I am wondering if the people who want this for mod_vhost_* actually
>> want something else, namely an easy way to get the root dir of a web
>> application in php/cgi/whatever...
>> What about this idea:
>> Add two new cgi env variables: CONTEXT_ROOT and CONTEXT_ROOT_PATH (or
>> APP_ROOT/APP_ROOT_PATH or ...). And add a new config directive
> Feh... DOCUMENT_ROOT was bad enough, do we have to persist the concept
> of sharing such things with the app?  For that matter, what are the vars
> that are used in app doc models today, why would we have to invent this
> again?

It's not only about the DOCUMENT_ROOT variable. The main problem is
interaction with other modules. Mainly mod_rewrite, which uses the
document root for -f and -d checks.

And as I said earlier the copy-whole-server_rec technique doesn't work
here because mod_rewrite checks whether the server_rec is same in
request and in conf:

     *  check for the ugly API case of a virtual host section where no
     *  mod_rewrite directives exists. In this situation we became no chance
     *  by the API to setup our default per-server config so we have to
     *  on-the-fly assume we have the default config. But because the default
     *  config has a disabled rewriting engine we are lucky because can
     *  just stop operating now.
    if (conf->server != r->server) {
        return DECLINED;

Ondřej Surý <>

View raw message