Module dav with http_auth

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

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. [email protected]

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs