You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Vasiliy Baranov <Va...@Sun.COM> on 2008/09/05 11:43:01 UTC

[users@httpd] per-subdirectory 405 Method Not Allowed in .htaccess file for read-only WebDAV

Dear Experts,

I have a directory named 'foo' in which I have a subdirectory named 
'bar' and an '.htaccess' file in which I need to specify that all 
methods expect GET, HEAD, OPTIONS, and PROPFIND on all resources in the 
'bar' subdirectory should result in 405 Method Not Allowed response. The 
directory layout is as follows:

    foo
        .htaccess
        bar
        ...

I cannot have .htaccess in 'bar' and thus cannot specify <LimitExcept> 
for the 'bar' directory, plus <Limit> and <LimitExcept> both result in 
403 Forbidden rather than 405 Method Not Allowed. Am I to use 
mod_rewrite rewrites with the R=405 flag? If so, can I somehow add the 
list of allowed methods to the Allow header in 405 Method Not Allowed 
responses as required by RFC 2616 section 10.4.6?

The ultimate goal here is to make the 'bar' subdirectory of the 
WebDAV-enabled 'foo' directory read-only for everyone.

Thanks,
Vasiliy

---------------------------------------------------------------------
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] per-subdirectory 405 Method Not Allowed in .htaccess file for read-only WebDAV

Posted by Justin Pasher <ju...@newmediagateway.com>.
Vasiliy Baranov wrote:
> Dear Experts,
>
> I have a directory named 'foo' in which I have a subdirectory named 
> 'bar' and an '.htaccess' file in which I need to specify that all 
> methods expect GET, HEAD, OPTIONS, and PROPFIND on all resources in 
> the 'bar' subdirectory should result in 405 Method Not Allowed 
> response. The directory layout is as follows:
>
>    foo
>        .htaccess
>        bar
>        ...
>
> I cannot have .htaccess in 'bar' and thus cannot specify <LimitExcept> 
> for the 'bar' directory, plus <Limit> and <LimitExcept> both result in 
> 403 Forbidden rather than 405 Method Not Allowed. Am I to use 
> mod_rewrite rewrites with the R=405 flag? If so, can I somehow add the 
> list of allowed methods to the Allow header in 405 Method Not Allowed 
> responses as required by RFC 2616 section 10.4.6?
>
> The ultimate goal here is to make the 'bar' subdirectory of the 
> WebDAV-enabled 'foo' directory read-only for everyone.

Without being able to either move/create an .htaccess file under bar or 
specify the settings in the global apache config, I don't think there is 
a way to make the <Limit> apply just to the bar directory. You would 
need to encompass it in a <Directory> or <Location> directive, but those 
directives are only allowed in the global and virtualhost config context.

Even with mod_rewrite, since you are actually tricking the server to 
report the 405 error code, I don't think you'll be able to report a 
proper list of commands in the "Allow" header without using <Limit>.

Justin Pasher

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