Wrong download links with custom port

Hello!

Im running Seafile server on custom port 8443 due to provider limitations on 443.

In general routing is working, site is available with ssl, but I have issue with download/upload links - it has no port before ‘/seafhttp/…’ If I add it manually - it start to download.

seafile-server.yml:

  caddy.reverse_proxy: "{{upstreams 80}}"
  caddy.reverse_proxy.header_up: "Host {http.request.host}"
  caddy.reverse_proxy.header_up_1: "X-Real-IP {remote_host}"
  caddy.reverse_proxy.header_up_2: "X-Forwarded-For {remote_host}"
  caddy.reverse_proxy.header_up_3: "X-Forwarded-Proto https"

seahub_settings.py:

CSRF_TRUSTED_ORIGINS = [‘https://:8443’]
SECURE_PROXY_SSL_HEADER = (‘HTTP_X_FORWARDED_PROTO’, ‘https’)
SERVICE_URL = ‘https://:8443’
FILE_SERVER_ROOT = ‘https://:8443/seafhttp’
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True

Starting from Seafile 12.0, the settings SERVICE_URL and FILE_SERVER_ROOT in seahub_settings.py are deprecated and no longer used to generate download/upload links.

To fix the missing port in your links, please follow these steps:

  1. Update the .env file:
    Modify the SEAFILE_SERVER_HOSTNAME variable to include your custom port. For example:

    SEAFILE_SERVER_HOSTNAME=yourdomain.com:8443
    SEAFILE_SERVER_PROTOCOL=https
    
  2. Verify Docker Port Mapping:
    Ensure your docker-compose.yml (or the file defining the Caddy service) correctly maps the host port 8443 to the container port.

  3. Restart the containers:
    Apply the changes by restarting your Seafile Docker setup:

    docker-compose down
    docker-compose up -d
    
    
    

This is a known issue reported by other users transitioning to version 12: