# Module dav with http\_auth

**URL:** <https://www.ruby-forum.com/t/module-dav-with-http-auth/205007>\
**Category:** NGINX\
**Created:** [March 26, 2011, 8:25pm UTC](https://www.ruby-forum.com/t/module-dav-with-http-auth/205007 "2011-03-26T20:25:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [March 26, 2011, 8:25pm UTC](https://www.ruby-forum.com/t/module-dav-with-http-auth/205007/1 "2011-03-26T20:25:32Z")

</div>

Hello!

I’m wanting to create my own “firefox sync” service. As I could read,  
it’s only a dav service without any special thing. So I tried to  
create it like, enabling the dav module[1] in nginx. I’ve read the  
example, but I think there’s something missing. Here’s my  
configuration:

server {  
listen (ipv4)443;  
listen [(ipv6)]:443;  
server\_name weave.domain.tld;  
access\_log /var/log/nginx/weave\_access.log main;  
error\_log /var/log/nginx/weave\_error.log info;

ssl on;  
ssl\_certificate /etc/nginx/ssl/all.signed.crt;  
ssl\_certificate\_key /etc/nginx/ssl/all.key;

root /var/www/vhosts/weaver.domain/htdocs ;  
client\_body\_temp\_path /var/www/vhosts/weave.domain/tmp ;  
dav\_methods PUT DELETE MKCOL COPY MOVE;  
create\_full\_put\_path on;  
dav\_access user:rw ;

location ~ /user/([a-z]+)/.\* {  
auth\_basic ‘Firefox Sync’;  
auth\_basic\_user\_file /var/www/vhosts/weave.domain/$1.htpasswd;  
}  
}

I’ve created a user 8say, “my\_example”) and related password, so that  
I’ve a " /var/www/vhosts/weave.domain/my\_example.htpasswd" file  
I’ve created the related user/my\_example directory.

But nginx tells me:  
2011/03/26 20:22:16 [error] 23025#0: \*144 no user/password was  
provided for basic authentication, client: (ipv4), server:  
weave.domain.tld, request: “OPTIONS /user/my\_example/ HTTP/1.1”, host:  
“weave.domain.tld”

Nginx version is  
nginx -v  
nginx version: nginx/0.8.53

I don’t understand this error - I use cadaver for my test, and provide  
the username/password… I thikn the “dav\_access” should give the  
rights to read and write to authenticated users… ?

Thank you in advance!

Cheers,

C.

[1] [http://wiki.nginx.org/HttpDavModule](http://wiki.nginx.org/HttpDavModule)

---

<div class="post-metadata">

**Author:** ![SSCSSdric\_Jeanneret](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/85f322/32.png) [@SSCSSdric\_Jeanneret](https://www.ruby-forum.com/u/SSCSSdric_Jeanneret)\
**Post date:** [March 27, 2011, 1:37pm UTC](https://www.ruby-forum.com/t/module-dav-with-http-auth/205007/2 "2011-03-27T13:37:35Z")

</div>

On Sat, Mar 26, 2011 at 08:24:56PM +0100, Cdric Jeanneret wrote:

Hi there,

> I’m wanting to create my own “firefox sync” service. As I could read,  
> it’s only a dav service without any special thing.

As I understand it, it’s not quite that simple. Search for  
“weave\_minimal”  
for one implementation of the server side of that service that is  
reported  
to work with nginx.

But separate from that, your question is about dav and auth…

> location ~ /user/([a-z]+)/.\* {  
> auth\_basic ‘Firefox Sync’;  
> auth\_basic\_user\_file /var/www/vhosts/weave.domain/$1.htpasswd;  
> }

> I’ve created a user 8say, “my\_example”) and related password, so that  
> I’ve a " /var/www/vhosts/weave.domain/my\_example.htpasswd" file  
> I’ve created the related user/my\_example directory.

(Note that “my\_example” doesn’t match this location. But I guess your  
real test user does.)

> But nginx tells me:  
> 2011/03/26 20:22:16 [error] 23025#0: \*144 no user/password was  
> provided for basic authentication, client: (ipv4), server:  
> weave.domain.tld, request: “OPTIONS /user/my\_example/ HTTP/1.1”, host:  
> “weave.domain.tld”

That’s error\_log. Also look in access\_log, and you should see two  
requests. (At least, I do when I try a similar test.)

> I don’t understand this error - I use cadaver for my test, and provide  
> the username/password…

My cadaver issues one “OPTIONS /” request without user/pass; nginx  
replies  
401, then cadaver reissues the request with user/pass which nginx  
accepts  
(and then replies 405, but that’s a slightly-side issue).

So the http\_auth-with-dav part looks fine to me. Unless you have some  
other combination of what you did / what you saw / what you expected to  
see to report.

One issue you will likely come across is that nginx dav doesn’t seem  
to natively handle OPTIONS. Another is that Firefox Sync doesn’t seem  
to just be a dav filespace. But they can be addressed separately –  
the http\_auth part should be working!

All the best,

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![SSCSSdric\_Jeanneret](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/85f322/32.png) [@SSCSSdric\_Jeanneret](https://www.ruby-forum.com/u/SSCSSdric_Jeanneret)\
**Post date:** [March 27, 2011, 6:45pm UTC](https://www.ruby-forum.com/t/module-dav-with-http-auth/205007/3 "2011-03-27T18:45:32Z")

</div>

Hello Francis!

Yes, I fumbled on this weave\_minimal - I’m currently trying to get the  
python version running - not so easy ;).

For the dav part, I saw that there was an error in directory path… a  
“weaver” instead of “weave”. So yeah, it’s working fine - even if I  
don’t need it anymore.

Thank you for your answer.

Cheers,

C.
