[SOLVED] Seafdav 502 Bad Gateway after upgrade to 7.1.3 yesterday (Docker)

Hi,

Docker container upgrades automatically against latest tag.

Last night, 7.1.3 was upgraded.

This morning, I have report of backup failures (I use Foldersync).

Also, Joplin client reports 502 Bad Gateway when trying to set up sync.

From the terminal a curl gives:

HTTP/2 502
content-type: text/html
date: Tue, 28 Apr 2020 09:13:29 GMT
server: nginx/1.14.0 (Ubuntu)
content-length: 182

Seafile is behind Traefik v2.

Logs are not showing anything relevant.

Solved.

I realized that an important change has been done in version 7.1 when reading the upgrade notes for the manual installation (https://download.seafile.com/published/seafile-manual/upgrade/upgrade_notes_for_7.1.x.md) :

“After Seafile 7.1.x, Seafdav does not support Fastcgi, only Wsgi.”

This means that if you are using Seafdav functionality and have deployed Nginx or Apache reverse proxy. You need to change Fastcgi to Wsgi."

I indeed use the internal nginx revproxy from the container and never had to bother about its config.

Turns out, the nginx config is dropped in the /shared volume, so when Seafile container image is upgraded, and changes are required in Nginx config, you should take care of those manually.

TL;DR, edit /shared/nginx/conf/seafile.nginx.conf

    location /seafdav {
        proxy_pass         http://127.0.0.1:8080/seafdav;
        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 $scheme;
        proxy_read_timeout  1200s;
        client_max_body_size 0;

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

# SECTION FOR SEAFILE 7.0 #     location /seafdav {
# SECTION FOR SEAFILE 7.0 #         client_max_body_size 0;
# SECTION FOR SEAFILE 7.0 #         fastcgi_pass    127.0.0.1:8080;
# SECTION FOR SEAFILE 7.0 #         fastcgi_param   SCRIPT_FILENAME     $document_root$fastcgi_script_name;
# SECTION FOR SEAFILE 7.0 #         fastcgi_param   PATH_INFO           $fastcgi_script_name;
# SECTION FOR SEAFILE 7.0 # 
# SECTION FOR SEAFILE 7.0 #         fastcgi_param   SERVER_PROTOCOL     $server_protocol;
# SECTION FOR SEAFILE 7.0 #         fastcgi_param   QUERY_STRING        $query_string;
# SECTION FOR SEAFILE 7.0 #         fastcgi_param   REQUEST_METHOD      $request_method;
# SECTION FOR SEAFILE 7.0 #         fastcgi_param   CONTENT_TYPE        $content_type;
# SECTION FOR SEAFILE 7.0 #         fastcgi_param   CONTENT_LENGTH      $content_length;
# SECTION FOR SEAFILE 7.0 #         fastcgi_param   SERVER_ADDR         $server_addr;
# SECTION FOR SEAFILE 7.0 #         fastcgi_param   SERVER_PORT         $server_port;
# SECTION FOR SEAFILE 7.0 #         fastcgi_param   SERVER_NAME         $server_name;
# SECTION FOR SEAFILE 7.0 # 
# SECTION FOR SEAFILE 7.0 #         access_log      /var/log/nginx/seafdav.access.log seafileformat;
# SECTION FOR SEAFILE 7.0 #         error_log       /var/log/nginx/seafdav.error.log;
# SECTION FOR SEAFILE 7.0 #     }

docker restart seafile.

Works.

Question for the docker maintainers: why is the embedded nginx config in the persistent volume? It’s an internal component of Seafile, and I expect its config to be upgraded accordingly without manual fixes.

This is because some users want to change the config of Nginx.

@daniel.pan Hi, I also experienced this problem when hosting with docker-compose, as it fetches the latest docker build automatically on each restart and breaks things without a warning.

It takes a lot of time to identify the problem for docker users.

Could you consider making a specific patch for docker releases (like a script reading the external files and apply the change), or at least adding a note on the deploy with docker doc page (when something could break for docker)?

Thank you so much!

Hi, I think I’m having the same problem but not completely sure because I’m just trying to use this functionality in seafile-mc 7.1.4 not before.

I have made the change you mention and restart the stack.

The error in seafdav.error.log now does not show “fastcgi” in the line but not sure if this means it has taken Wsgi correctly.

Also, there is a file: seafdav.conf that right now it contains in my case:

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

Is this correct or should I replace fastcgi with wsgi = true or something like that ?

My current error that is shown in seafdav.error.log is:

2020/06/09 14:40:39 [error] 7871#7871: *48 connect() failed (111: Connection refused) while connecting to upstream, client: 10.0.0.2, server: xxxxxxx.duckdns.org, request: "GET /seafdav HTTP/1.1", upstream: "http://127.0.0.1:8080/seafdav", host: "xxxxxxxx.duckdns.org"

Thank you very much for your support.

We will release a new version to fix the issue.

Same problem here as @ego …has this been solved?

Same issue as @ego and @glaterza6.

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

Default nginx config. Running through docker, I guess it might have something to do with my docker-compose.yml, but seafile is working great aside from seafdav.

Navigating to my.domain.com/seafdav gives me a 502.

SOLVED: I was editing the wrong file. I was adding the config above to seafile.conf rather than seafdav.conf.