You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Ralf S. Engelschall" <rs...@engelschall.com> on 1998/02/26 10:10:03 UTC
Interesting problem: virtual host config
In PR#1790 we have been reported that mod_rewrite RewriteRules in
<VirtualHost> sections inherit the RewriteRules from the main server _only_
under a very special situation: WHEN NO DIRECTIVES OF mod_rewrite OCCUR IN
THIS <VirtualHost> section. If at least a `RewriteEngine off' is there all
works correctly.
The interesting problem which we have to solve is the following: If there is
at least one directive of a module, the per-server config-merging function is
used and thus can merge correctly. Mod_rewrite here does its job correct
because it initialized the per-server config with "engine disabled" and merges
this correctly. But now when no mod_rewrite directive exists in such a
<VirtualHost> section, it seems like mod_rewrite is never called (which in
general is fine). But then mod_rewrite cannot create a special per-server
config for this particular virtual host (where the engine would be disabled
per default) and thus the config of the main server is applied to this virtual
host.
Hmmmm.... I currently don't know any solution for this.
I just need either some way to force mod_rewrite to create a default
per-server config even for virtual hosts where actually none of its directives
exist or alternatively a way to check under runtime that the rewriting engine
is operating for a request to such a virtual server so it can decline
immediately.
Any ideas on how to solve this problem?
Ralf S. Engelschall
rse@engelschall.com
www.engelschall.com
Re: Interesting problem: virtual host config
Posted by Dean Gaudet <dg...@arctic.org>.
I just sent this to the bugdb:
Yeah one way to hack around this is to put:
server_rec *created_in;
into your server config. Then during your create_server_config routine
initialize it to the server you're created in.
Then later on during run time you can compare r->server to
your_config->created_in and if they're different you can assume whatever
defaults you want to.
It's an ugly part of the API.
Dean
On Thu, 26 Feb 1998, Ralf S. Engelschall wrote:
>
> In PR#1790 we have been reported that mod_rewrite RewriteRules in
> <VirtualHost> sections inherit the RewriteRules from the main server _only_
> under a very special situation: WHEN NO DIRECTIVES OF mod_rewrite OCCUR IN
> THIS <VirtualHost> section. If at least a `RewriteEngine off' is there all
> works correctly.
>
> The interesting problem which we have to solve is the following: If there is
> at least one directive of a module, the per-server config-merging function is
> used and thus can merge correctly. Mod_rewrite here does its job correct
> because it initialized the per-server config with "engine disabled" and merges
> this correctly. But now when no mod_rewrite directive exists in such a
> <VirtualHost> section, it seems like mod_rewrite is never called (which in
> general is fine). But then mod_rewrite cannot create a special per-server
> config for this particular virtual host (where the engine would be disabled
> per default) and thus the config of the main server is applied to this virtual
> host.
>
> Hmmmm.... I currently don't know any solution for this.
>
> I just need either some way to force mod_rewrite to create a default
> per-server config even for virtual hosts where actually none of its directives
> exist or alternatively a way to check under runtime that the rewriting engine
> is operating for a request to such a virtual server so it can decline
> immediately.
>
> Any ideas on how to solve this problem?
>
> Ralf S. Engelschall
> rse@engelschall.com
> www.engelschall.com
>