You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Dan Goodes <da...@planetmirror.com> on 2004/08/25 03:28:20 UTC

[users@httpd] and

Hi guys,

Hopefully someone here can lend a hand.

I have an Apache-1.3 system here that isn't behaving as expected (I can't
upgrade to Apache-2, because some 3rd party modules I use don't work in
2.0 yet).

In the working configuration, I have a series of <Directory> statements
which set environment variables, and perform other functions:

<Directory /some/path>
<Directory /some/path/subdir1>
<Directory /some/path/subdir2>

and so on.

I want to put in some redirection rules in each location, that direct
requests to different URLs based on the Directory (assume the Directory
sections are closed off):

<Directory /some/path>
   .... Some Rewrite Directives
<Directory /some/path/subdir1>
   .... Other Rewrite Directives
<Directory /some/path/subdir2>
   .... Still Other Rewrite Directives

This obviously doesn't work as expected, since the Rewrite directives for
/some/path will be run, rendering those for subdir1 and subdir2 useless.

So I decided to look at Location directives, as these are applied in the
order they appear in the config file. Assume I have

Alias /path/ /some/path/

then:

<Location /path/subdir1>
   .... Other Rewrite Directives
<Location /path/subdir2>
   .... Still Other Rewrite Directives
<Location /path>
   .... Some Rewrite Directives

should do what I want. I.e. If the path matches /path/subdir1 then those
rules will be applied, and wont be over-ridden by those for /path. Right?
Or have I completely missed the point?

The next question I have is, if I do it that way, *NONE* of my Location
directives are even read. So nothing at all under /some/path has any
directives applied to it. A request to

/path/<anything>

has no directives applied to it, Rewrite or otherwise.

Why is that? How can it be that the <Directory> statements work, and
corresponding <Location> statements don't?

Any help/advice would be greatly appreciated (and will keep upper
management off my case!).


Regards,

Dan Goodes  :  Systems Programmer  :  dang@planetmirror.com

Help support PlanetMirror - Australia's largest Internet archive
by signing up for PlanetMirror Premium : http://planetmirror.com


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] and

Posted by Dan Goodes <da...@planetmirror.com>.
On Fri, 27 Aug 2004 at 09:22, Dan Goodes wrote:

> On Thu, 26 Aug 2004 at 09:47, Joshua Slive wrote:
>
> > On Thu, 26 Aug 2004 15:06:43 +1000 (EST), Dan Goodes
> > <da...@planetmirror.com> wrote:
> > >
> > > As i said, the problem is that in the latter configuration, none of the
> > > Location sections (including the catch-all <Location "/pub*">) actually
> > > match (i.e. no Layout stuff is actually implimented, etc, regardless of
> > > the URL).
> >
> > Note the "*" on the end is not necessary.  <Location> does substring matches.
>
> I realise it shouldn't be necessary, however I was trying pretty much
> everything I knew to get it to work.
>
> > Have you tried non-mod_layout directives (like just Allow/Deny for
> > example) to see if they work?  This could be a bug in mod_layout.
>
> Note that none of the directives in there work. The rewrite rules, the
> IndexOptions. It's almost like apache it either ignoring the directive
> altogether, or isn't getting a location match for /pub/anything.

Just chasing this up, as it still has me stumped. Surely if this is as
profound a problem as it seems (essentially, it almost seems as if the
entire <Location> structure doesn't work), someone else would have
reported something. And since that hasn't happened, I can only guess that
something's wrong with my logic - it's a simple-enough setup I would
imagine; there are probably many many more complex setups out there.


Regards,

Dan Goodes  :  Systems Programmer  :  dang@planetmirror.com

Help support PlanetMirror - Australia's largest Internet archive
by signing up for PlanetMirror Premium : http://planetmirror.com


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] and

Posted by Dan Goodes <da...@planetmirror.com>.
On Thu, 26 Aug 2004 at 09:47, Joshua Slive wrote:

> On Thu, 26 Aug 2004 15:06:43 +1000 (EST), Dan Goodes
> <da...@planetmirror.com> wrote:
> >
> > As i said, the problem is that in the latter configuration, none of the
> > Location sections (including the catch-all <Location "/pub*">) actually
> > match (i.e. no Layout stuff is actually implimented, etc, regardless of
> > the URL).
>
> Note the "*" on the end is not necessary.  <Location> does substring matches.

I realise it shouldn't be necessary, however I was trying pretty much
everything I knew to get it to work.

> Have you tried non-mod_layout directives (like just Allow/Deny for
> example) to see if they work?  This could be a bug in mod_layout.

Note that none of the directives in there work. The rewrite rules, the
IndexOptions. It's almost like apache it either ignoring the directive
altogether, or isn't getting a location match for /pub/anything.

--Dan


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] and

Posted by Joshua Slive <js...@gmail.com>.
On Thu, 26 Aug 2004 15:06:43 +1000 (EST), Dan Goodes
<da...@planetmirror.com> wrote:
>
> As i said, the problem is that in the latter configuration, none of the
> Location sections (including the catch-all <Location "/pub*">) actually
> match (i.e. no Layout stuff is actually implimented, etc, regardless of
> the URL).

Note the "*" on the end is not necessary.  <Location> does substring matches.

Have you tried non-mod_layout directives (like just Allow/Deny for
example) to see if they work?  This could be a bug in mod_layout.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] and

Posted by Dan Goodes <da...@planetmirror.com>.
On Wed, 25 Aug 2004 at 21:08, Joshua Slive wrote:

> On Thu, 26 Aug 2004 10:54:18 +1000 (EST), Dan Goodes
>
> Well, there are a bunch of possible problems.  It would be much easier
> to check your config if you gave us exact and unaltered config
> experpts.
>

I have attached two configs:

o httpd.conf-working contains working configuration. I have taken out a
lot of sections that are identical to those in there (such as a lot of the
virtual hosts, and a lot of the <Directory> sections - all of which exist
under /server/ftp/pub/).

o httpd.conf-notworking is, surprisingly, the non-working config, where
I've attempted to take the <Directory> sections and convert them to
<Locations> (refer to the original email for why I need to do this).

As i said, the problem is that in the latter configuration, none of the
Location sections (including the catch-all <Location "/pub*">) actually
match (i.e. no Layout stuff is actually implimented, etc, regardless of
the URL).

I can't see anywhere that might be overriding the <Location>.

Regards,

Dan Goodes  :  Systems Programmer  :  dang@planetmirror.com

Help support PlanetMirror - Australia's largest Internet archive
by signing up for PlanetMirror Premium : http://planetmirror.com

Re: [users@httpd] and

Posted by Joshua Slive <js...@gmail.com>.
On Thu, 26 Aug 2004 10:54:18 +1000 (EST), Dan Goodes
<da...@planetmirror.com> wrote:
> On Wed, 25 Aug 2004 at 07:38, suomi wrote:
> 
> > check out the sequence which the <Location> and <Directory> directives
> > are applied in. that fooled me once many days:
> 
> Thanks. My big problem is this:
> 
> I had a directory section:
> 
> <Directory "/some/path">
>         ....
> </Directory>
> 
> that had several directives (layout, Rewrite, and so on) that worked.
> 
> I changed this to use Location:
> 
> <Location "/path">
>         ....
> </Location>
> 
> and it no longer seems to get seen. I have an Alias command to alias
> /path to /some/path.
> 
> So I'm stumped. I can't work out why Directory would work fine, but the
> corresponding Location does not.

Well, there are a bunch of possible problems.  It would be much easier
to check your config if you gave us exact and unaltered config
experpts.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] and

Posted by Dan Goodes <da...@planetmirror.com>.
On Wed, 25 Aug 2004 at 07:38, suomi wrote:

> check out the sequence which the <Location> and <Directory> directives
> are applied in. that fooled me once many days:

Thanks. My big problem is this:

I had a directory section:

<Directory "/some/path">
	....
</Directory>

that had several directives (layout, Rewrite, and so on) that worked.

I changed this to use Location:

<Location "/path">
	....
</Location>

and it no longer seems to get seen. I have an Alias command to alias
/path to /some/path.

So I'm stumped. I can't work out why Directory would work fine, but the
corresponding Location does not.

Regards,

Dan Goodes  :  Systems Programmer  :  dang@planetmirror.com

Help support PlanetMirror - Australia's largest Internet archive
by signing up for PlanetMirror Premium : http://planetmirror.com


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] and

Posted by suomi <ap...@ayni.com>.
Hi Dan
check out the sequence which the <Location> and <Directory> directives 
are applied in. that fooled me once many days:

If you use directory, files, and location directives on a web site, you 
must consider the following processing sequence:

the directives directory, directorymatch, files, filesmatch, location, 
locationmatch are processed in that order, which means that a files 
directive will overrun a directory directive (if that where possible), 
and a location directive will overrun both of them

be aware that the location, locationmatch directives are processed last, 
and they may invalidate any directory, directorymatch and files, 
filesmatch directives. If you have a location, locationmatch directive 
in the general setup in httpd.conf, it will overrun all 
directory,directorymatch and files,filesmatch directives you specify in 
particular virtual-server directives.

suomi

Dan Goodes wrote:
> Hi guys,
> 
> Hopefully someone here can lend a hand.
> 
> I have an Apache-1.3 system here that isn't behaving as expected (I can't
> upgrade to Apache-2, because some 3rd party modules I use don't work in
> 2.0 yet).
> 
> In the working configuration, I have a series of <Directory> statements
> which set environment variables, and perform other functions:
> 
> <Directory /some/path>
> <Directory /some/path/subdir1>
> <Directory /some/path/subdir2>
> 
> and so on.
> 
> I want to put in some redirection rules in each location, that direct
> requests to different URLs based on the Directory (assume the Directory
> sections are closed off):
> 
> <Directory /some/path>
>    .... Some Rewrite Directives
> <Directory /some/path/subdir1>
>    .... Other Rewrite Directives
> <Directory /some/path/subdir2>
>    .... Still Other Rewrite Directives
> 
> This obviously doesn't work as expected, since the Rewrite directives for
> /some/path will be run, rendering those for subdir1 and subdir2 useless.
> 
> So I decided to look at Location directives, as these are applied in the
> order they appear in the config file. Assume I have
> 
> Alias /path/ /some/path/
> 
> then:
> 
> <Location /path/subdir1>
>    .... Other Rewrite Directives
> <Location /path/subdir2>
>    .... Still Other Rewrite Directives
> <Location /path>
>    .... Some Rewrite Directives
> 
> should do what I want. I.e. If the path matches /path/subdir1 then those
> rules will be applied, and wont be over-ridden by those for /path. Right?
> Or have I completely missed the point?
> 
> The next question I have is, if I do it that way, *NONE* of my Location
> directives are even read. So nothing at all under /some/path has any
> directives applied to it. A request to
> 
> /path/<anything>
> 
> has no directives applied to it, Rewrite or otherwise.
> 
> Why is that? How can it be that the <Directory> statements work, and
> corresponding <Location> statements don't?
> 
> Any help/advice would be greatly appreciated (and will keep upper
> management off my case!).
> 
> 
> Regards,
> 
> Dan Goodes  :  Systems Programmer  :  dang@planetmirror.com
> 
> Help support PlanetMirror - Australia's largest Internet archive
> by signing up for PlanetMirror Premium : http://planetmirror.com
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org