You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Christoph Anton Mitterer <ca...@scientia.net> on 2011/12/27 02:26:47 UTC

[users@httpd] setting options for a single file

Hi.

Is it possible to set options (i.e. Allow from all) for a _single_ file
while not using <Location>?

I'd like to have a default-deny policy for the whole vhost,... therefore
I have something like:
<Directory /somepath/to/my/vhosts/root>
Order allow,deny
deny from all
<Direcotry>

But I'd like to allow access for single files or dirs.

For dirs this is obviously easy, but for files (e.g. /robots.txt not (as
<Files> would match any files of that name below)



And I usually try to avoid using <Location>


thx,
Chris.

Re: [users@httpd] setting options for a single file

Posted by Christoph Anton Mitterer <ca...@scientia.net>.
On Tue, 2011-12-27 at 10:28 -0500, Eric Covener wrote:
> > Is there a different whether I match
> > "^/path/tovHost$"
> > or
> > "^/path/tovHost/$"
> 
> yes, the note unique to 2.3 is about that.  I don't remember where it mattered.

Yeah,.. I've read the note in trunk-doc,... but it is unclear (at least
to me),.. and given the importance, it should be clarified IMHO.
Especially as mod_dir could also have effects?!


Cheers,
Chris.

Re: [users@httpd] setting options for a single file

Posted by Eric Covener <co...@gmail.com>.
> Is there a different whether I match
> "^/path/tovHost$"
> or
> "^/path/tovHost/$"

yes, the note unique to 2.3 is about that.  I don't remember where it mattered.

---------------------------------------------------------------------
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] setting options for a single file

Posted by Christoph Anton Mitterer <ca...@scientia.net>.
On Tue, 2011-12-27 at 09:54 -0500, Eric Covener wrote:
> Probably doesn't make much practical sense, since you can just use
> directory match in 2.3/2.4 and no change to Files or Directory would
> likely to ever be available in any older release.

Ah... now I've seen what you mean,... it now supports $ :D

So with 2.3/2.4/trunk I could just use:

<Direcotory /path/tovHost>
	foo
	bar
	deny from all
</Directory>


#selectively allow subdirs
<Direcotory /path/tovHost/subDir>
	allow from all
</Directory>


#allow only /path/tovHost/robots.txt
<DirecotoryMatch "^/path/tovHost$">
	<Files robots.txt>
		allow from all
	</Files>
</DirectoryMatch>


And the files section would not be used on any subdirs of /path/tovHost,
right?


Is there a different whether I match
"^/path/tovHost$"
or
"^/path/tovHost/$"


Cheers,
Chris.

Re: [users@httpd] setting options for a single file

Posted by Eric Covener <co...@gmail.com>.
On Tue, Dec 27, 2011 at 9:35 AM, Christoph Anton Mitterer
<ca...@scientia.net> wrote:
> On Tue, 2011-12-27 at 09:31 -0500, Eric Covener wrote:
>> You could undo it in a subsequent section that only matched longer
>> directory paths.  DirectoryMatch is pretty limited in 2.2 and probably
>> not so helpful.
>
> Yeah,.. I've thought about this,.. but that also seems a bit hacky...
>
> Would it make sense to feature-request a non-inheriting <Files> section?

Probably doesn't make much practical sense, since you can just use
directory match in 2.3/2.4 and no change to Files or Directory would
likely to ever be available in any older release.

---------------------------------------------------------------------
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] setting options for a single file

Posted by Christoph Anton Mitterer <ca...@scientia.net>.
On Tue, 2011-12-27 at 09:31 -0500, Eric Covener wrote:
> You could undo it in a subsequent section that only matched longer
> directory paths.  DirectoryMatch is pretty limited in 2.2 and probably
> not so helpful.

Yeah,.. I've thought about this,.. but that also seems a bit hacky...

Would it make sense to feature-request a non-inheriting <Files> section?

Cheers,
Chris.

Re: [users@httpd] setting options for a single file

Posted by Eric Covener <co...@gmail.com>.
On Tue, Dec 27, 2011 at 8:54 AM, Christoph Anton Mitterer
<ca...@scientia.net> wrote:
> On Tue, 2011-12-27 at 03:31 -0500, Eric Covener wrote:
>> nest Files inside of Directory.
> That shouldn't help should it?
>
> When I want to do this for files in the root dir of my vhost (e.g.
> robots.txt),... I'd have to add the <Files> in that <Directory>.... and
> it would also apply to all other subdirs of the vhost's root.
>

You could undo it in a subsequent section that only matched longer
directory paths.  DirectoryMatch is pretty limited in 2.2 and probably
not so helpful.

---------------------------------------------------------------------
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] setting options for a single file

Posted by Christoph Anton Mitterer <ca...@scientia.net>.
On Tue, 2011-12-27 at 03:31 -0500, Eric Covener wrote:
> nest Files inside of Directory.
That shouldn't help should it?

When I want to do this for files in the root dir of my vhost (e.g.
robots.txt),... I'd have to add the <Files> in that <Directory>.... and
it would also apply to all other subdirs of the vhost's root.


Cheers,
Chris.

Re: [users@httpd] setting options for a single file

Posted by Eric Covener <co...@gmail.com>.
On Mon, Dec 26, 2011 at 8:26 PM, Christoph Anton Mitterer
<ca...@scientia.net> wrote:
> Hi.
>
> Is it possible to set options (i.e. Allow from all) for a _single_ file
> while not using <Location>?
>
> I'd like to have a default-deny policy for the whole vhost,... therefore
> I have something like:
> <Directory /somepath/to/my/vhosts/root>
> Order allow,deny
> deny from all
> <Direcotry>
>
> But I'd like to allow access for single files or dirs.
>
> For dirs this is obviously easy, but for files (e.g. /robots.txt not (as
> <Files> would match any files of that name below)

nest Files inside of Directory.

---------------------------------------------------------------------
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