[SOLVED] Seafile Upload not working (seafhttp?)


#1

My current seafile setup is in a container behind a nginx reverse proxy. This configuration works perfectly, besides the upload not working. When uploading files, a NOT FOUND error in red appears in the upload box.

How can this be fixed?

Basic network overview:

Frontend (nginx revproxy) <-> Backend (container)
https://example.org:41000 <-> 10.0.0.146:41000

Seafile configuration:

SERVICE_URL = https://example.org:41000
FILESERVER_ROOT = https://example.org:41000/seafhttp

Nginx configuration:

server {
    listen 41000 ssl http2;
    server_name example.org;

    proxy_set_header X-Forwarded-For $remote_addr;

       location / {
            proxy_pass         http://10.0.0.146:41000;
            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;
        }

        location /seafhttp {
            rewrite ^/seafhttp(.*)$ $1 break;
            proxy_pass http://10.0.0.146: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;
        }

        location /media {
            root /srv/seafile/seafile-server-latest/seahub;
        }

        location ~ / {
                proxy_pass http://10.0.0.146:41000;
        }

        (I removed the working SSL configuration here)

seahub.log:

2018-05-12 17:37:51,557 [WARNING] django.request:170 get_response Not Found: /seafhttp/upload-aj/f619a67c-e26d-423a-9f90-31f971a739a5


#2

What do your error logs report about the failed upload? Also, are you doing an upload via the webui or via syncing?


#3

BTW, since you are using a custom port rather than 443 or 80, you should change your host entry in Nginx. Seafile with wsgi has a tendency to revert to default ports without this correction.

proxy_set_header Host $host:$server_port;

That may or may not resolve your problem. Be sure to restart NGinx after making the correction.


#4

I’m doing an upload via the Web UI. The Web UI outputs “NOT FOUND” in red inside the upload box. I’ve added the seahub.log error in the thread:

2018-05-12 17:37:51,557 [WARNING] django.request:170 get_response Not Found: /seafhttp/upload-aj/f619a67c-e26d-423a-9f90-31f971a739a5

This did not help. I’ve tried adding it in every location inside the nginx configuration possible.


#5

@wthess Do I need to open any port to the outside world besides 41000? And where should I try putting proxy_set_header Host $host:$server_port?


#6

In your NGinx configuration, replace this line:

proxy_set_header Host $host;

with this:

proxy_set_header Host $host:$server_port;


#7

As for your port 41000… There is nothing wrong with it. However, I just noticed that you are proxy-passing to the same port number internally. That could cause problems.

Try changing your seahub config to a different port and then proxy pass to that port. Port 8000 is default, so your NGinx config, with the changes I’m suggesting, would be:

 server {
      listen 41000 ssl http2;
      server_name example.org;

proxy_set_header X-Forwarded-For $remote_addr;

   location / {
        proxy_pass         http://10.0.0.146:8000;
        proxy_set_header   Host $host:$server_port;
        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;
    }

    location /seafhttp {
        rewrite ^/seafhttp(.*)$ $1 break;
        proxy_pass http://10.0.0.146: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;
    }

    location /media {
        root /srv/seafile/seafile-server-latest/seahub;
    }

    location ~ / {
            proxy_pass http://10.0.0.146:8000;
    }

    (I removed the working SSL configuration here)

#8

Please note, I just made another change… Your last “location” entry. Changed it to 8000 as well, though I’m not sure why you have that included.

In fact, just go ahead and comment that location out. You have two root locations defined in your server block. That last one isn’t necessary.


#9

My last location change (which overwrote all other locations) and the host header you provided made it work. I’ve now changed it accordingly. And now file uploads work! Thank you soo much for your help.

server {
    listen 41000 ssl http2;
    server_name example.org;

    proxy_set_header X-Forwarded-For $remote_addr;

       location / {
        proxy_pass         http://10.0.0.146:41000;
        proxy_set_header Host $host:$server_port;
        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;
        }

        location /seafhttp {
            rewrite ^/seafhttp(.*)$ $1 break;
            proxy_pass http://10.0.0.146: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;
        }

        location /media {
            root /srv/seafile/seafile-server-latest/seahub;
                proxy_pass http://10.0.0.146:41000;
        }

#       location ~ / {
#               proxy_pass http://10.0.0.146:41000;
#       }

#10

Lol… I had just edited my last response to add that you should comment that one out, but you beat me to it by about 3 seconds. :slight_smile:


#11

Do you have this behind a web server? My installation worked pretty much out of the box even with big files. I do remember however that I had some trouble with big files when i got it behind nginx.