Network error in seafile 12.0 docker with nginx

Hello when I want to send a file to the cloud I get a network error . As in the attached image

Settings in nginx

server {
listen 8443 ssl;
ssl_certificate /etc/pki/nginx/server.crt;
ssl_certificate_key /etc/pki/nginx/server.key;

server_name softziger.com;

proxy_set_header X-Forwarded-For $remote_addr;

location / {
proxy_pass http://192.168.02: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 $scheme;
proxy_read_timeout 1200s;

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://192.168.0.2: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;
}

location /seafdav {
fastcgi_pass 192.168.0.2:8080;
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 REMOTE_ADDR $remote_addr;

client_max_body_size 0;
access_log      /var/log/nginx/seafdav.access.log;
error_log       /var/log/nginx/seafdav.error.log;

}
}

In seahub_settings.py I added the following
SERVICE_URL = “https://mydomian.com:8443
ALLOWED_HOSTS = [‘.mydomain.com’]
FILE_SERVER_ROOT = ‘http://mydomain.com:8443/seafhttp
CSRF_TRUSTED_ORIGINS = [‘https://mydomain.com:8443’]

What can i still do

Please help greetings

SERVICE_URL and FILE_SERVER_ROOT is no longer used in Seafile version 12.0.

I suggest you correct this part first. Then you can check chrome’s developer console to find detailed error about the network problem.

Hello,thank you for your interest in the topic.
From seahub_settings.py I removed
SERVICE_URL = “https://mydomain.com:8443
FILE_SERVER_ROOT = ‘https://mydomain.com:8443/seafhttp

in the console I saw when uploading the file that:
https://mydomain.com:8443/library/77665e01-aeec-4c25-a618-1d5180eb40df/pliki/” - this path is correct

here is not the correct path
http://mydomain.com/seafhttp/upload-aj/f8f18b4a-19e0-414d-b3bd-56e3f18df

It looks like there is a redirection error in the nginx proxy server.

How can I solve this greetings.

Do you correctly set the two environment variables: SEAFILE_SERVER_PROTOCOL and SERAFILE_SERVER_HOSTNAME ?

This is what’s set in the .eny file:
SEAFILE_SERVER_HOSTNAME=mydomain.com
SEAFILE_SERVER_PROTOCOL=http

in the caddy.yml file
ports:

  • 8000:80
  • 4430:443

Ports 443 are occupied by another service,
and port 8443 is occupied by the nginx server.

If you set

SEAFILE_SERVER_HOSTNAME=mydomain.com
SEAFILE_SERVER_PROTOCOL=http

Then Seafile will use the URL http://mydomain.com/seafhttp/xxxx to upload files, exactly following your settings.

I don’t quite understand what wrong in your setup.

I think I might see the problem. @Ziger it looks like your reverse proxy is on port 8443 instead of the usual 80 or 443. So I think your seafile is either at http://mydomain.com:8443 or https://mydomain.com:8443.

If that’s the case, you need SEAFILE_SERVER_PROTOCOL to be right for how you are connecting (http or https), and SEAFILE_SERVER_HOSTNAME to have the name, including the port. So instead of SEAFILE_SERVER_HOSTNAME=mydomain.com use SEAFILE_SERVER_HOSTNAME=mydomain.com:8443.

Hello, thank you for your help. I want to achieve https encryption on port 8443. I used Nginx for this purpose. Since the attempt to redirect ports through the server failed when sending files, I disabled the Nginx proxy server to simplify the configuration. The current configuration is as follows.

In the .env file
SEAFILE_SERVER_HOSTNAME=mydomain.com
SEAFILE_SERVER_PROTOCOL=http
in the caddy.yml file, I changed the ports
- 8000:80
- 4430:443
in the seahub_settings.py file
ALLOWED_HOSTS = [‘.mydomain.com’]
CSRF_TRUSTED_ORIGINS = [‘https://mydomain.com:8443’] - I didn’t change this I don’t think it matters.

I stopped and started docker compose. After restarting, I can log in
to the website http://mydomain.com:8000 but I still get the same error when sending a file.

http://mydomain.com/seafhttp/upload-aj/6b136e9e-481f-4813-b3f9-a71eea119b5f?ret-json=1

In my opinion, it should look like this:

http://mydomain.com:8000/seafhttp/upload-aj/6b136e9e-481f-4813-b3f9-a71eea119b5f?ret-json=1

In Docker seafile, the caddy proxy is installed by default and its configuration should be caddy.yml

-80:80
-443:433

but for me this configuration is not acceptable. How can this be solved?

Translated with DeepL.com (free version)

You should change SEAFILE_SERVER_HOSTNAME to mydomain.com:8000 if you want the web interface to use http://mydomain.com:8000 prefix in URL to upload files.

In short, SEAFILE_SERVER_HOSTNAME and SEAFILE_SERVER_PROTOCOL controls the URL of the web interface to upload files.

Hello, I have configured it according to your instructions.

SEAFILE_SERVER_HOSTNAME=http://mydomain.com:8000
SEAFILE_SERVER_PROTOCOL=http

After stopping and starting Docker,

I entered the link into the browser:
http://mydomain.com:8000/

The browser does not display anything. There is no login page.
The entire page is blank.

How about change SEAFILE_SERVER_HOSTNAME to mydomain.com:8000, removing the http part?

When set to
SEAFILE_SERVER_HOSTNAME= mydomain.com:8000,

the browser reports
Unable to connect

When set to
SEAFILE_SERVER_HOSTNAME=http://mydomain.com:8000,

the browser does not display anything. There is no login page.
The entire page is blank.