WebDAV with Authentication Layer
Nima Mohammadi
nima.mohammadi at ut.ac.ir
Sun Aug 17 22:20:49 UTC 2014
Hi folks,
I'm using Nginx as a WebDAV server using nginx-dav-ext-module. Now I
needed to add an authentication layer to the WebDAV server which
couldn't only be relying on a static htpasswd file. So I looked around
and found the ngx_http_auth_request_module of Maxim Dounin. Now, once a
request comes in, Nginx asks my web app, which is written in python
using Pyramid framework, to authenticate the user. When the method is
GET, PROPFIND, OPTION, DELETE, etc. it works very well, but the problem
is that in case the HTTP method is PUT, it fails! I'm sure the problem
isn't with the python code as the subrequest, which
ngx_http_auth_request is supposed to make, doesn't even reach my web
app. As soon as the auth_request line in the config file is commented,
uploading files with PUT works.
My configuration is as follows:
server {
listen 8080;
root /L/;
charset utf-8;
location /disks/ {
auth_request /auth_webservice;
client_body_temp_path /tmp/client-tmp 1 2;
create_full_put_path on;
client_max_body_size 2000m;
dav_access user:rw group:rw all:r;
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS;
}
location /auth_webservice {
proxy_pass http://127.0.0.1:6543/auth/webdav;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
proxy_set_header X-Original-Method $request_method;
}
location = /auth_open {
return 204;
}
location / {
uwsgi_pass unix:///tmp/uwsgi.sock;
include uwsgi_params;
}
}
It might be of interest to you to know that even when I change the
auth_request to /auth_open, PUT still fails with an HTTP error 500.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20140818/9d224ddd/attachment.html>
More information about the nginx
mailing list