Alias doesn"t work correctly? (Re: Alias question)

Alias doesn"t work correctly? (Re: Alias question)

am 07.06.2007 19:13:22 von nuke

szr wrote:
> Mark Taylor wrote:
> > szr wrote:
> >
> > > Hello. I'm using Apache 1.3.27 and I've encountered a small
> > > problem using Alias'es.
> > >
> > > Say I have the following directory structure:
> > >
> > > /var/www/html
> > > /var/www/abc_html
> > > /var/abc/data
> > >
> > >
> > > and this in my httpd.conf:
> > >
> > > Alias /abc/ "/var/www/abc_html/"
> > > Alias /abc/data/ "/var/abc/data"
> > >
> > >
> > > If I enter the following URL's in my browser:
> > >
> > > http://host/abc/
> > >
> > > I get the contents of /var/www/abc_html like I would expect, but
> > > entering:
> > >
> > > http://host/abc/data/
> > >
> > > Doesn't give me the contents of /var/abc/data, but instead yield a
> > > 404 and in the error_log:
> > >
> > > ... File does not exist: /var/www/abc_html/data
> > >
> > >
> > > Keep in mind this describes exactly what I'm doing, reduced to
> > > it's basic parts for clarity sake.
> > >
> > > Is there any reason why it wont work?
> > >
> > > Seems the only way I could get round this was to use AliasMatch,
> > > it that feels like a hack for something that seems like it should
> > > be so basic.
> > >
> > > (And yes I know I could always use a symlink, but in my particular
> > > case I need to avoid that and do it via httpd.conf, as this
> > > actually involves a cross platform system we're developing.
> > >
> > > Thank you.
> > >
> > > -szr
> > >
> > >
> > >
> >
> > Probably because mod_alias finds the first occurance of /abc/ and,
> > finding a match it executes and terminates. Then again, I'm not real
> > sure alias works with two levels of directories. I suspect not.
> >
> > I'm wondering exactly what you are trying to do. If your data
> > directory really contains data is there are real reason why you
> > want it in the directory root structure? Usually data paths are
> > outside of the http root for security reasons. You are explicitly
> > putting the data in the http path eliminating security. Of course,
> > this may be exactly what you want to do....
>
> Thank you for replying. The scenario I described was just one I made
> up on the fly to describe the problem I was having with the Alias
> directive.
>
> It doesn't seem to make any sense that I could, for instance, do the
> following and it works as expected:
>
> Alias /somewebapp/foo.pl "/var/www/html/somewebapp/foo_linux.pl"
>
> but not be able to have more than one level:
>
> Alias /abc/data/ "/var/abc/data"
>
> (syntatically they would be the same, no?)
>
>
> Thanks again.


Same problem seems to exist on 2.x Apache.

I would categorize this as a bug.

Why shou'dn't one be able to build a complete vurtual directory
structure? IIS has allowed that for years (not that I would ever really
use it), but if Apache truly doesn't have a way to do that with normal
Alias directives, then what real good is it to only have one level? IMHO
it makes it practically useless for any.

Is there any way to make it work?

Re: Alias doesn"t work correctly? (Re: Alias question)

am 07.06.2007 21:16:58 von HansH

"tony.p" schreef in bericht
news:S0X9i.12940$2v1.1920@newssvr14.news.prodigy.net...
>> > > Say I have the following directory structure:
>> > > /var/www/html
>> > > /var/www/abc_html
>> > > /var/abc/data
>> > >
>> > > and this in my httpd.conf:
>> > > Alias /abc/ "/var/www/abc_html/"
>> > > Alias /abc/data/ "/var/abc/data"
>> > >
>> > >
>> > Probably because mod_alias finds the first occurance of /abc/ and,
>> > finding a match it executes and terminates.
Right you are:
$ apache2ctl -V
Server version: Apache/2.2.3
Server built: Apr 15 2007 14:35:34
$ apache2ctl -t
[Thu Jun 07 20:06:09 2007] [warn] The Alias directive in ... at line ..
will
probably never match because it overlaps an earlier Alias.

> Same problem seems to exist on 2.x Apache.
Same misconfiburation that is, just swapping the lines will cure
Alias /abc/data/ /var/abc/data
Alias /abc/ /var/www/abc_html/
>
> I would categorize this as a bug.
NO, although not-writing the warning into ANY log -even if the offending
alias is definded after errorlog- does feel buggy.


HansH

Re: Alias doesn"t work correctly? (Re: Alias question)

am 07.06.2007 22:05:29 von nuke

HansH wrote:
> "tony.p" schreef in bericht
> news:S0X9i.12940$2v1.1920@newssvr14.news.prodigy.net...
> > > > > Say I have the following directory structure:
> > > > > /var/www/html
> > > > > /var/www/abc_html
> > > > > /var/abc/data
> > > > >
> > > > > and this in my httpd.conf:
> > > > > Alias /abc/ "/var/www/abc_html/"
> > > > > Alias /abc/data/ "/var/abc/data"
> > > > >
> > > > >
> > > > Probably because mod_alias finds the first occurance of /abc/
> > > > and, finding a match it executes and terminates.
> Right you are:
> $ apache2ctl -V
> Server version: Apache/2.2.3
> Server built: Apr 15 2007 14:35:34
> $ apache2ctl -t
> [Thu Jun 07 20:06:09 2007] [warn] The Alias directive in ... at
> line .. will
> probably never match because it overlaps an earlier Alias.
>
> > Same problem seems to exist on 2.x Apache.
> Same misconfiburation that is, just swapping the lines will cure
> Alias /abc/data/ /var/abc/data
> Alias /abc/ /var/www/abc_html/

Yes that appears to work.

> > I would categorize this as a bug.
> NO, although not-writing the warning into ANY log -even if the
> offending alias is definded after errorlog- does feel buggy.

Exactly. In my test setup, I see nothing about aliases overlapping or
what have you, just a standard 404 error.