WebDAV extension

Seafile WebDAV Server(SeafDAV) is added in seafile server 2.1.0.

In the wiki below, we assume your seafile installation folder is /data/haiwen.

SeafDAV Configuration

The configuration file is /data/haiwen/conf/seafdav.conf. If it is not created already, you can just create the file.

  1. [WEBDAV]
  2. # Default is false. Change it to true to enable SeafDAV server.
  3. enabled = true
  4. port = 8080
  5. # Change the value of fastcgi to true if fastcgi is to be used
  6. fastcgi = false
  7. # If you deploy seafdav behind nginx/apache, you need to modify "share_name".
  8. share_name = /

Every time the configuration is modified, you need to restart seafile server to make it take effect.

  1. ./seafile.sh restart

Sample Configuration 1: No nginx/apache

Your WebDAV client would visit the Seafile WebDAV server at http://example.com:8080

  1. [WEBDAV]
  2. enabled = true
  3. port = 8080
  4. fastcgi = false
  5. share_name = /

Sample Configuration 2: With Nginx

Your WebDAV client would visit the Seafile WebDAV server at http://example.com/seafdav

  1. [WEBDAV]
  2. enabled = true
  3. port = 8080
  4. fastcgi = true
  5. share_name = /seafdav

In the above config, the value of ‘’’share_name’’’ is changed to ‘’’/seafdav’’’, which is the address suffix you assign to seafdav server.

Nginx without HTTPS

The corresponding Nginx configuration is (without https):

  1. location /seafdav {
  2. fastcgi_pass 127.0.0.1:8080;
  3. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  4. fastcgi_param PATH_INFO $fastcgi_script_name;
  5. fastcgi_param SERVER_PROTOCOL $server_protocol;
  6. fastcgi_param QUERY_STRING $query_string;
  7. fastcgi_param REQUEST_METHOD $request_method;
  8. fastcgi_param CONTENT_TYPE $content_type;
  9. fastcgi_param CONTENT_LENGTH $content_length;
  10. fastcgi_param SERVER_ADDR $server_addr;
  11. fastcgi_param SERVER_PORT $server_port;
  12. fastcgi_param SERVER_NAME $server_name;
  13. client_max_body_size 0;
  14. proxy_connect_timeout 36000s;
  15. proxy_read_timeout 36000s;
  16. proxy_send_timeout 36000s;
  17. send_timeout 36000s;
  18. # This option is only available for Nginx >= 1.8.0. See more details below.
  19. proxy_request_buffering off;
  20. access_log /var/log/nginx/seafdav.access.log;
  21. error_log /var/log/nginx/seafdav.error.log;
  22. }

Nginx with HTTPS

Nginx conf with https:

  1. location /seafdav {
  2. fastcgi_pass 127.0.0.1:8080;
  3. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  4. fastcgi_param PATH_INFO $fastcgi_script_name;
  5. fastcgi_param SERVER_PROTOCOL $server_protocol;
  6. fastcgi_param QUERY_STRING $query_string;
  7. fastcgi_param REQUEST_METHOD $request_method;
  8. fastcgi_param CONTENT_TYPE $content_type;
  9. fastcgi_param CONTENT_LENGTH $content_length;
  10. fastcgi_param SERVER_ADDR $server_addr;
  11. fastcgi_param SERVER_PORT $server_port;
  12. fastcgi_param SERVER_NAME $server_name;
  13. fastcgi_param HTTPS on;
  14. fastcgi_param HTTP_SCHEME https;
  15. client_max_body_size 0;
  16. proxy_connect_timeout 36000s;
  17. proxy_read_timeout 36000s;
  18. proxy_send_timeout 36000s;
  19. send_timeout 36000s;
  20. # This option is only available for Nginx >= 1.8.0. See more details below.
  21. proxy_request_buffering off;
  22. access_log /var/log/nginx/seafdav.access.log;
  23. error_log /var/log/nginx/seafdav.error.log;
  24. }

By default Nginx will buffer large request body in temp file. After the body is completely received, Nginx will send the body to the upstream server (seafdav in our case). But it seems when file size is very large, the buffering mechanism dosen’t work well. It may stop proxying the body in the middle. So if you want to support file upload larger for 4GB, we suggest you install Nginx version >= 1.8.0 and add proxy_request_buffering off to Nginx configuration.

Sample Configuration 3: With Apache

The following configuratioin assumes you use Apache 2.4 or later.

Your WebDAV client would visit the Seafile WebDAV server at http://example.com/seafdav

  1. [WEBDAV]
  2. enabled = true
  3. port = 8080
  4. fastcgi = false
  5. share_name = /seafdav

In the above config, the value of ‘’’share_name’’’ is changed to ‘’’/seafdav’’’, which is the address suffix you assign to seafdav server. Note that we do not use fastcgi for Apache.

Modify Apache config file (site-enabled/000-default):

Apache without HTTPS

Based on your apache configuration when you deploy Seafile with Apache, add seafdav related config:

  1. <VirtualHost *:80>
  2. ServerName www.myseafile.com
  3. # Use "DocumentRoot /var/www/html" for Centos/Fedora
  4. # Use "DocumentRoot /var/www" for Ubuntu/Debian
  5. DocumentRoot /var/www
  6. Alias /media /home/user/haiwen/seafile-server-latest/seahub/media
  7. RewriteEngine On
  8. <Location /media>
  9. Require all granted
  10. </Location>
  11. #
  12. # seafile fileserver
  13. #
  14. ProxyPass /seafhttp http://127.0.0.1:8082
  15. ProxyPassReverse /seafhttp http://127.0.0.1:8082
  16. RewriteRule ^/seafhttp - [QSA,L]
  17. #
  18. # WebDAV
  19. # We use http proxy, since SeafDAV is incompatible with FCGI proxy in Apache 2.4.
  20. #
  21. ProxyPass /seafdav http://127.0.0.1:8080/seafdav
  22. ProxyPassReverse /seafdav http://127.0.0.1:8080/seafdav
  23. #
  24. # seahub
  25. #
  26. SetEnvIf Request_URI . proxy-fcgi-pathinfo=unescape
  27. SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
  28. ProxyPass / fcgi://127.0.0.1:8000/
  29. </virtualhost>

Apache with HTTPS

Based on your apache configuration when you Enable Https on Seafile web with Apache, add seafdav related config:

  1. <VirtualHost *:443>
  2. ServerName www.myseafile.com
  3. DocumentRoot /var/www
  4. SSLEngine On
  5. SSLCertificateFile /path/to/cacert.pem
  6. SSLCertificateKeyFile /path/to/privkey.pem
  7. Alias /media /home/user/haiwen/seafile-server-latest/seahub/media
  8. <Location /media>
  9. ProxyPass !
  10. Require all granted
  11. </Location>
  12. RewriteEngine On
  13. #
  14. # seafile fileserver
  15. #
  16. ProxyPass /seafhttp http://127.0.0.1:8082
  17. ProxyPassReverse /seafhttp http://127.0.0.1:8082
  18. RewriteRule ^/seafhttp - [QSA,L]
  19. #
  20. # WebDAV
  21. # We use http proxy, since SeafDAV is incompatible with FCGI proxy in Apache 2.4.
  22. #
  23. ProxyPass /seafdav http://127.0.0.1:8080/seafdav
  24. ProxyPassReverse /seafdav http://127.0.0.1:8080/seafdav
  25. #
  26. # seahub
  27. #
  28. SetEnvIf Request_URI . proxy-fcgi-pathinfo=unescape
  29. SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
  30. ProxyPass / fcgi://127.0.0.1:8000/
  31. </virtualhost>

Notes on Clients

Please first note that, there are some known performance limitation when you map a Seafile webdav server as a local file system (or network drive).

  • Uploading large number of files at once is usually much slower than the syncing client. That’s because each file needs to be committed separately.
  • The access to the webdav server may be slow sometimes. That’s because the local file system driver sends a lot of unnecessary requests to get the files’ attributes.

So WebDAV is more suitable for infrequent file access. If you want better performance, please use the sync client instead.

Windows

The client recommendation for WebDAV depends on your Windows version:

  • For Windows XP: Only non-encryped HTTP connection is supported by the Windows Explorer. So for security, the only viable option is to use third-party clients, such as Cyberduck or Bitkinex.
  • For Vista and later versions: Windows Explorer supports HTTPS connection. But it requires a valid certificate on the server. It’s generally recommended to use Windows Explorer to map a webdav server as network dirve. If you use a self-signed certificate, you have to add the certificate’s CA into Windows’ system CA store.

Linux

On Linux you have more choices. You can use file manager such as Nautilus to connect to webdav server. Or you can use davfs2 from the command line.

To use davfs2

  1. sudo apt-get install davfs2
  2. sudo mount -t davfs -o uid=<username> https://example.com/seafdav /media/seafdav/

The -o option sets the owner of the mounted directory to so that it’s writable for non-root users.

It’s recommended to disable LOCK operation for davfs2. You have to edit /etc/davfs2/davfs2.conf

  1. use_locks 0

Mac OS X

Finder’s support for WebDAV is also not very stable and slow. So it is recommended to use a webdav client software such as Cyberduck.

Frequently Asked Questions

Clients can’t connect to seafdav server

By default, seafdav is disabled. Check whether you have enabled = true in seafdav.conf.
If not, modify it and restart seafile server.

The client gets “Error: 404 Not Found”

If you deploy SeafDAV behind Nginx/Apache, make sure to change the value of share_name as the sample configuration above. Restart your seafile server and try again.

Windows Explorer reports “file size exceeds the limit allowed and cannot be saved”

This happens when you map webdav as a network drive, and tries to copy a file larger than about 50MB from the network drive to a local folder.

This is because Windows Explorer has a limit of the file size downloaded from webdav server. To make this size large, change the registry entry on the client machine. There is a registry key named FileSizeLimitInBytes under HKEY_LOCAL_MACHINE -> SYSTEM -> CurrentControlSet -> Services -> WebClient -> Parameters.