[SOLVED] Upload/Download Doesn't Work since reverse proxy nginx with https

Good day

I’m having an issue with serving seafile with nginx using https. (After switching from servering static files from port 8000).
It seems like seafhttp is not configured correctly as every upload, download or sync operation fails.
When trying to download with the web Interface it serves me a ‘502 bad gateway’ after ignoring the message from my browser that there is something wrong with my ssl certificate, i.e. that the certificate doesn’t match with the domain which the download link is leading to or something similar (Translation).
I just upgraded to Version 6.1.2 on Debian. After not being able to fix the issue with Version 5.1.3.
The same problem still persists.
I have data on the Server that I would like to keep.
Any help would be greatly appreciated!

EDIT: I just realised that the preview of Images works. But when clicking on download I get the error mentioned above…

Here are my relevant config files with domainnames obfuscated and user_name, id and keys removed:

ccnet.conf:
SERVICE_URL = https://mydomain.com/seafile

seahub_settings.py:
FILE_SERVER_ROOT = 'https://www.mydomain.com/seafhttp'
SERVE_STATIC = False
MEDIA_URL = '/seafmedia/'
COMPRESS_URL = MEDIA_URL
STATIC_URL = MEDIA_URL + 'assets/'
SITE_ROOT = '/seafile/'
LOGIN_URL = '/seafile/accounts/login/'

nginx.conf:
server {
        listen 80 default_server;
        listen [::]:80 default_server;
        server_name mydomain.com;
        return 301 https://mydomain.com$request_uri;
        rewrite ^ https://$http_host$request_uri? permanent;
}

server {
        # SSL configuration
        #
        listen 443;
        ssl on;
        ssl_certificate /etc/letsencrypt/live/mydomain.ch/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/keys/0000_key-certbot.pem;
        server_tokens off;
        server_name www.mydomain.com;
        proxy_set_header X-Fowarded-For $remote_addr;

        location / {
                root /data/www;
        }

        location /seafhttp {
                rewrite ^/seafhttp(.*)$ $1 break;
                proxy_pass https://127.0.0.1:8082;
                client_max_body_size 0;
         }

         location /seafile {
                fastcgi_pass    127.0.0.1:8000;
                fastcgi_param   SCRIPT_FILENAME     $document_root$fastcgi_script_name;
                fastcgi_param   PATH_INFO           $fastcgi_script_name;

                fastcgi_param    SERVER_PROTOCOL        $server_protocol;
                fastcgi_param   QUERY_STRING        $query_string;
                fastcgi_param   REQUEST_METHOD      $request_method;
                fastcgi_param   CONTENT_TYPE        $content_type;
                fastcgi_param   CONTENT_LENGTH      $content_length;
                fastcgi_param    SERVER_ADDR         $server_addr;
                fastcgi_param    SERVER_PORT         $server_port;
                fastcgi_param    SERVER_NAME         $server_name;
                fastcgi_param   HTTPS               on; # enable this line only if https is used
                access_log      /var/log/nginx/seahub.access.log;
                error_log       /var/log/nginx/seahub.error.log;
        }

         location /seafmedia {
                rewrite ^/seafmedia(.*)$ /media$1 break;
                root /home/seafile/seafile-server-latest/seahub;
        }
        index index.html index.htm index.nginx-debian.html;
}

Don’t kno alot abou sub-folder deploy and yes I know it’s in doc. Did you try set

FILE_SERVER_ROOT = 'https://www.mydomain.com/seafile/seafhttp'

?

I did change it both in config and in the System admin.
I now get this message from seafile instead:
‘Sorry, but the requested page could not be found.’

Alright!
Found the solution!

All my original settings were ok only that

location /seafhttp {
                rewrite ^/seafhttp(.*)$ $1 break;
                proxy_pass https://127.0.0.1:8082;
                client_max_body_size 0;
         }

should instead be:

location /seafhttp {
                rewrite ^/seafhttp(.*)$ $1 break;
                proxy_pass http://127.0.0.1:8082;
                client_max_body_size 0;
         }

Notice no https but http for the proxy_pass…