Welcome! Log In Create A New Profile

Advanced

WebDAV with Authentication Layer

Nima Mohammadi
August 17, 2014 06:22PM
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.
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

WebDAV with Authentication Layer

Nima Mohammadi August 17, 2014 06:22PM

Re: WebDAV with Authentication Layer

Nima Mohammadi August 19, 2014 05:56PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 157
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready