Fwd: WEBDAV: accomodate MKCOL for somewhat broken clients
Jonathan Kolb
jon at b0g.us
Sat Jun 15 23:56:20 UTC 2013
You should be able to just duplicate the MKCOL line in the second map for
DELETE, but since MOVE also requires a trailing / on the Destination
header, I can't think of a way around it without something much more hacky
(I haven't tested it this time, but I think it'll work):
map $http_destination $dest_missing_slash {
default 1;
~/$ 0;
}
map $request_method $proxy_hack {
default 0;
MOVE $dest_missing_slash;
COPY $dest_missing_slash;
}
server {
location / {
dav_methods MKCOL MOVE COPY DELETE PUT;
if ($proxy_hack) {
# proxy back to ourselves with a fixed up header
# the destination header gets fixed up here, and the uri will get
fixed up the second time around
# you can also listen on a unix port and proxy_pass there for this
part
proxy_set_header Destination $http_destination/;
proxy_pass http://localhost;
break;
}
if ($add_slash) { rewrite ^ $uri/ break; }
}
}
On Sat, Jun 15, 2013 at 2:09 AM, Vladimir Dronnikov <dronnikov at gmail.com>wrote:
> Thanks. That is elegant. Another stopper is that nginx dav does
> differentiate folders vs files when performing DELETE/MOVE. Is it possible
> to append slashes if target is a directory? Tia
> 15.06.2013 0:12 пользователь "Jonathan Kolb" <jon at b0g.us> написал:
>
> This worked in a quick test for me:
>>
>> map $uri $missing_slash {
>> default 1;
>> ~/$ 0;
>> }
>>
>> map $request_method $add_slash {
>> default 0;
>> MKCOL $missing_slash;
>> }
>>
>> server {
>> location / {
>> dav_methods MKCOL;
>> if ($add_slash) { rewrite ^ $uri/ break; }
>> }
>> }
>>
>>
>>
>> On Thu, Jun 13, 2013 at 8:28 AM, Vladimir Dronnikov <dronnikov at gmail.com>wrote:
>>
>>> Any chance to have this trailing slash controlled by an option?
>>> Or would you people mind to share a chunk of nginx config which would
>>> append that slash?
>>> TIA
>>>
>>>
>>> On Thu, Jun 13, 2013 at 4:21 PM, Maxim Dounin <mdounin at mdounin.ru>wrote:
>>>
>>>> Hello!
>>>>
>>>> On Thu, Jun 13, 2013 at 12:15:54PM +0400, Vladimir Dronnikov wrote:
>>>>
>>>> > Hello!
>>>> >
>>>> > I wonder if
>>>> >
>>>> https://github.com/dvv/nginx/commit/3a8cdadea196a594fd1940be02818f51d1b1769fis
>>>> > feasible? The rationale is to be more liberal to the zoo of webdav
>>>> > clients.
>>>>
>>>> Doesn't looks like a good change to me.
>>>>
>>>> --
>>>> Maxim Dounin
>>>> http://nginx.org/en/donation.html
>>>>
>>>> _______________________________________________
>>>> nginx-devel mailing list
>>>> nginx-devel at nginx.org
>>>> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>>>>
>>>
>>>
>>> _______________________________________________
>>> nginx-devel mailing list
>>> nginx-devel at nginx.org
>>> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>>>
>>
>>
>> _______________________________________________
>> nginx-devel mailing list
>> nginx-devel at nginx.org
>> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>>
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20130615/c08fece7/attachment.html>
More information about the nginx-devel
mailing list