You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Eli Marmor <ma...@netmask.it> on 2003/09/25 16:23:41 UTC

Making "_" of mod_vhost_alias.c Configurable

Hi,

When the "%N" or "%-N" of VirtualDocumentRoot (or one of its friends)
in mod_vhost_alias.c doesn't exist, mod_vhost_alias.c puts "_" instead
of it.

I want to add a directive that when being defined, will replace this
"_" by another string, or by an empty string.

An empty string (or ".") can be good for the following case:

You want to allow different domains with different depth of names (i.e.
"level2.com" vs. "levelD.levelC.levelB.com") to live together, in a
reversed order of directories, i.e. "level2.com" under "/var/com/level2"
and "levelD.levelC.levelB.com" under "/var/com/levelB/levelC/levelD".

The problem is that there is no condition directive that examines the
NUMBER of levels (let's ignore mod_rewrite and its options...).

So all you can do is:

VirtualDocumentRoot  "/var/%-1/%-2/%-3/%-4"

In the case of "levelD.levelC.levelB.com" it's perfect; You get what
you asked for ("/var/com/levelB/levelC/levelD").

However, in the case of "level2.com" you get "/var/com/level2/_/_"
(instead of "/var/com/level2").

If it was possible to replace "_" by "" or by ".", you could get what
you wanted.

While it's ugly to replace the "_" in the code, and may break the
compatibility with old versions, an optional directive is elegant.

Such a directive should check that there is no ".." or other hacks in
the string, because sometimes the webmaster gives partial permissions
to the specific webmaster of this specific virtual host, and we don't
want to break the security of the server by letting that sub-webmaster
to reach areas which he shouldn't reach.

My question: if I send a patch, is there any interest in adding it to
the code?
Otherwise, it will be easier for me to replace the "_" in the code.

P.S. the source of the problem is a limitation of the wildcards in
named; you can't define "*.mydomain.com" and "*.*.mydomain.com", but
only "*.mydomain.com". And there is no "?" that means "1-level-wild-
card". So all the names that ends by ".mydomain.com" will translate to
the same IP.

Thanks,
-- 
Eli Marmor
marmor@netmask.it
CTO, Founder
Netmask (El-Mar) Internet Technologies Ltd.
__________________________________________________________
Tel.:   +972-9-766-1020          8 Yad-Harutzim St.
Fax.:   +972-9-766-1314          P.O.B. 7004
Mobile: +972-50-23-7338          Kfar-Saba 44641, Israel