WebDAV behind a nginx reverse proxy

Christian Schoepplein c.schoepplein at musin.de
Thu Oct 12 12:41:58 UTC 2017


Hi,

I've installed nginx as a reverse proxy in front of an apache webdav 
server. Everything seems to be OK so far, but renaming or moving files 
failes.

This is my current vhost for the webdav access on the nginx rev. proxy:

server {
  listen 443 ssl;
  server_name "~^(?<part1>(webdav|schulweb))\-ca(?<part2>\d{4})\-(?<part3>(muenchen|augsburg))\.musin\.de$";

  dav_methods     PUT DELETE MKCOL COPY MOVE;
  dav_ext_methods PROPFIND OPTIONS;

  location / {
    resolver ns.musin.de;
    set $target $part1.ca$part2.$part3.musin.de;
    proxy_pass http://$target:80;
    
    client_max_body_size 0;

    set $dest $http_destination;

    if ($http_destination ~ "^https://(.+)") {
      set $dest http://$1;
    }

    proxy_set_header Destination $dest;
    proxy_http_version 1.1;
    proxy_buffering off;
    proxy_read_timeout 300;
    proxy_send_timeout 300;
    proxy_pass_request_headers on;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto http;
    proxy_set_header X-Forwarded-User $http_authorization;
    proxy_set_header Host $target;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Accept-Encoding "";
    proxy_pass_header Date;
    proxy_pass_header Server;
    proxy_pass_header Authorization;
    more_set_input_headers 'Authorization: $http_authorization';
    more_set_headers -s 401 'WWW-Authenticate: Basic realm="$target"';
  }

  access_log  /var/log/nginx/webdav-access.log upstreamlog;
  error_log /var/log/nginx/webdav-error.log warn;
}

If I switch the vhost to listen on port 80 without ssl, everything is 
fine and files can be renamed or moved via webdav.

I think the problem is related to this thread, but however, the solution 
described there does unfortunatly not help:

http://mailman.nginx.org/pipermail/nginx/2007-January/000504.html

I am absolutely no nginx, proxy or http  expert, so maybe some settings 
in the config above are wrong. If you see anything that is strange or 
can be removed or should be changed, please let me know. Also every idea 
how to solve my problem would be great. Also every hint how to debug 
such kind of problems are highly wellcome :-).

Cheers and thanks,

  Schoepp

-- 
Christian Schoepplein

Landeshauptstadt Muenchen
Referat fuer Bildung und Sport
Zentrum fuer Informationstechnologie im Bildungsbereich (ZIB)
- Netze und Servermanagement

Postanschrift:                          Bueroanschrift:

Landeshauptstadt Muenchen               Landeshauptstadt Muenchen
Referat fuer Bildung und Sport          Referat fuer Bildung und Sport
Postfach                                Bayerstr. 28 (Raum 5.326)

80313 Muenchen                          80335 Muenchen

T: +49 (0)89 233-85906
E: c.schoepplein (at) musin.de
I: http://www.zib.musin.de

Elektronische Kommunikation mit der Landeshauptstadt Muenchen, siehe: 
http://www.muenchen.de/ekomm

Bitte denken Sie an die Umwelt, bevor Sie diese E-Mail ausdrucken. Pro 
Blatt sparen Sie durchschnittlich 15g Holz, 260ml Wasser, 0,05kWh Strom 
und 5g CO2.



More information about the nginx mailing list