Network Error using Caddy on Debian 12

Hello,
I installed Seafile on my debian server using the Caddy webserver.
I have not touched any config files, the server worked on my local pc but it doesn’t through the internet.
Each time I want to upload a file (whether from the web interface or the iOS app), I have the following error: “Network Error”.
When I try to download a file, I’m redirected to an URL starting with 127.0.0.1:8082 displaying the error: “Access token not found”.
Here’s my Caddy config:

files.math3mat1x.xyz {
      log {
        output file /opt/seafile/logs/caddy.log
      }

  reverse_proxy localhost:8000

  handle_path /seafhttp* {
    reverse_proxy localhost:8082
  }
}

I don’t want to open any other port than port 443 on my router.
What am I doing wrong?

Thanks a lot!

Can you please provides some more details? What type of installation is it (manual or docker)? How does your configuration look like (especially FILE_SERVER_ROOT and SERVICE_URL)?

Thanks for the reply.
This is a manual installation (MySQL) and here’s the seahub_settings.py file:

# -*- coding: utf-8 -*-
SECRET_KEY = "secret"
SERVICE_URL = "http://files.math3mat1x.xyz/"

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'seahub-db',
        'USER': 'seafile',
        'PASSWORD': 'secret',
        'HOST': '127.0.0.1',
        'PORT': '3306',
        'OPTIONS': {'charset': 'utf8mb4'},
    }
}

What other information would you like to have?

I tried updating the Caddy config to mimic the Nginx config on the official website, but it still doesn’t work.
Here it is:

files.math3mat1x.xyz {
  log {
    output file /opt/seafile/logs/caddy.log
  }

  reverse_proxy localhost:8000

  handle_path /seafhttp* {
    reverse_proxy localhost:8082
  }

  handle /media* {
        root * /opt/seafile/seafile-server-latest/seahub
        file_server
  }
}

Now you can access files such as [https://]files.math3mat1x.xyz/media/css/seafile-ui.css

I don’t know if it is related, but your Caddy config indicates you are accessing Seafile on HTTPS, while your Seafile config points to HTTP. I know that Seafile is pretty picky about the path specified in FILE_SERVER_ROOT and SERVICE_URL, but I don’t know if the protocol matters.

Check your configuration in the WebUI under System Admininstration > Settings and make sure that FILE_SERVER_ROOT matches https://files.math3mat1x.xyz/ and SERVICE_URL matches https://files.math3mat1x.xyz/seafhttp.

Thanks for the reply. Yes the error was in the SERVICE_URL value, I didn’t read quite thoroughly the documentation :confused: