Seafile-WebDav behind Nginx proxy (Docker)

Hello,
I need help configuring Seafile-WebDav behind a reverse proxy (nginx). I’ve read all the topics regarding this subject on the forum but can’t find a solution.
Nginx as well as Seafile are running in as separate docker containters. The seafile webpage, seafile client as well as seadrive client work without any issue. I just can’t get webdav working. If I try to connect the following error occurs:

seafdav.access.log:
79.XXX.XX.XXX 192.168.64.2 [10/Feb/2021:22:16:23 +0100] "PROPFIND /seafdav/ HTTP/1.1" 499 0 "-" "Strongbox/3026 CFNetwork/1220.1 Darwin/20.3.0" -

Additionally the client (used to connect to seafile) comes up with a message “Connection timed out”.

I have no idea what causes this behavior. It would be very nice if someone could give me a hint what I’m doing wrong. Thank you!

This is my seafdav.conf:

[WEBDAV]
enabled = true
port = 8080
fastcgi = false
share_name = /seafdav

This is my nginx template for seafile:

server {
    listen        80;
    server_name   _;
    server_tokens off;

    location /seafile {
      rewrite ^ https://$http_host$request_uri? permanent;    # force redirect http to https
    }
}

server {
    listen        443 ssl http2;
    server_name   _;
    server_tokens off;

    ssl_protocols TLSv1.2;
    ssl_certificate /etc/ssl/private/cacert.pem;
    ssl_certificate_key /etc/ssl/private/privkey.pem;
    ssl_dhparam /etc/ssl/private/dhparam2048.pem;
    ssl_ecdh_curve secp384r1;
    ssl_ciphers EECDH+AESGCM:EDH+AESGCM:EECDH:EDH:!MD5:!RC4:!LOW:!MEDIUM:!CAMELLIA:!ECDSA:!DES:!DSS:!3DES:!NULL;
    ssl_prefer_server_ciphers on;
    ssl_session_timeout 10m;

    location /seafile {
        proxy_pass         http://127.0.0.1:8000;
        proxy_set_header   Host $host;
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Host $server_name;
        proxy_set_header   X-Forwarded-Proto https;
        proxy_http_version 1.1;
        proxy_connect_timeout  36000s;
        proxy_read_timeout  36000s;
        proxy_send_timeout  36000s;
        send_timeout  36000s;

        # used for view/edit office file via Office Online Server
        client_max_body_size 0;

        access_log      /var/log/nginx/seahub.access.log;
        error_log       /var/log/nginx/seahub.error.log;
    }

    location /seafhttp {
        rewrite ^/seafhttp(.*)$ $1 break;
        proxy_pass http://127.0.0.1:8082;
        client_max_body_size 0;
        proxy_connect_timeout  36000s;
        proxy_read_timeout  36000s;
        proxy_send_timeout  36000s;
        send_timeout  36000s;
        proxy_request_buffering off;
        proxy_http_version 1.1;
    }

    location /seafmedia {
        rewrite ^/seafmedia(.*)$ /media$1 break;
        root /opt/seafile/seafile-server-latest/seahub;
    }

    location /seafdav {
        proxy_pass         http://127.0.0.1:8080;
        proxy_set_header   Host $host;
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Host $server_name;
        proxy_set_header   X-Forwarded-Proto https;
        proxy_read_timeout  1200s;
        client_max_body_size 0;

        access_log      /var/log/nginx/seafdav.access.log;
        error_log       /var/log/nginx/seafdav.error.log;
    }
}

I know this post is 6 months old but I am getting the same error. However a few differences.

  • Only happens to one client; photoprism which is in docker on a different host.
  • Seafile is running within a LXD container and a different host.
  • All other clients connect fine.

I tried disabling http2 via NGINX but made no difference.

This thread might be helpful to you. I'm not that adept in Nginx, but I may be able to help if you post your configuration.

Thanks for the link but not quite the same issue.

Both NGINX and seafile are lxd containers on the same machine and webdav is working well for everything except photoprism. Photoprism does work against a Nextcloud instance.

I suspect it is photoprism but strange it works with Nextcloud webdav (nextcloud being on docker and a separate host).

NGINX proxy file.

Upgraded to Seafile 8.0.8 pro.

Thanks!

server {
    server_name seafile.example.com;
    proxy_set_header X-Forwarded-For $remote_addr;

    location / {

         proxy_pass         http://seafile:8000;
         proxy_set_header   Host $host;
         proxy_set_header   X-Real-IP $remote_addr;
         proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header   X-Forwarded-Host $server_name;
         proxy_set_header   X-Forwarded-Proto https;
         proxy_read_timeout  1200s;
         # used for view/edit office file via Office Online Server
         client_max_body_size 0;

         access_log      /var/log/nginx/seahub.access.log;
         error_log       /var/log/nginx/seahub.error.log;

    }

    location /seafhttp {

        rewrite ^/seafhttp(.*)$ $1 break;
        proxy_pass http://seafile:8082;
        client_max_body_size 0;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_connect_timeout  36000s;
        proxy_read_timeout  36000s;
        proxy_send_timeout  36000s;
        send_timeout  36000s;

        access_log      /var/log/nginx/seafhttp.access.log;
        error_log       /var/log/nginx/seafhttp.error.log;
	
    }

     location /seafdav {
        proxy_pass         http://seafile:8080;
        proxy_set_header   Host $host;
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Host $server_name;
        proxy_set_header   X-Forwarded-Proto https;
        proxy_http_version 1.1;
        proxy_connect_timeout  36000s;
        proxy_read_timeout  36000s;
        proxy_send_timeout  36000s;
        send_timeout  36000s;

        # This option is only available for Nginx >= 1.8.0. See more details below.
        client_max_body_size 0;
        proxy_request_buffering off;

        access_log      /var/log/nginx/seafdav.access.log;
        error_log       /var/log/nginx/seafdav.error.log;
    }


    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot



}
server {
    if ($host = seafile.example.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot



    listen 80;
    server_name seafile.example.com;
    return 404; # managed by Certbot


}