Seafile Avatar Does not Load

1. Caddy version (2.3):

2. How I run Caddy:

a. System environment:

Caddy is running in a docker container on an ubuntu server.
The instance of SeaFile is also in docker and part of the same bridge network.

b. Command:

docker-compose up -d

c. Service/unit/compose file:

    caddy:
        image: caddy:2 
        container_name: caddy
        #user: 1000:1000  
        #restart: "unless-stopped"
        ports:
            - 80:80  # Needed for the ACME HTTP-01 challenge.
            - 443:443
        volumes:
            - ~/caddy/Caddyfile:/etc/caddy/Caddyfile
            - ~/caddy/caddy-config:/config
            - ~/caddy/caddy-data:/data

d. My complete Caddyfile or JSON config:

{
    email 
    acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
}

seafile.mydomain.com {
 
  reverse_proxy seafile:80{
    php_fastcgi unix//run/php/php-fpm.sock {
    header_up X-Forwarded-Proto https
    }
  }

}

3. The problem I’m having:

I have a loaded and running docker container with Seafile. I am able to access it using the caddyfile as set up. However, the avatar image for my account is showing up as a broken link.

Based on my research the problem seems to be due to the absoute URL being requested for the image.

Avatar in share dialog missing seems to cover the issue as well as solutions for NGinx and Apache. I just can’t figure out how to do the same thing in Caddy2.

It sound like the HTTP_X_FORWARDED_PROTO needs to be set to HTTPS

4. Error messages and/or full log output:

I was unable to find any relevant error logs.

5. What I already tried:

I have tried following the advice in the following Topic Caddy2 Wordress

6. Links to relevant resources:

This is the broken image in question:
image

Thanks in advance for all the help!

Where are you looking? You should be able to see your logs by running docker-compose logs caddy.

This isn’t right. There’s a few syntactical errors here, and I think some confusion about what you need.

I don’t think Seafile is a PHP app, so it doesn’t make sense to have php_fastcgi here. From a quick google it looks like a Python app.

You’re missing a space between seafile:80 and {, spaces are significant in the Caddyfile.

You also don’t need the header_up line, because Caddy sets that header automatically.

Try this:

seafile.mydomain.com {
	reverse_proxy seafile:80
}

Hi,

Yes There is a log in docker log. It just doesn’t have any message that relates to the image error since it seem everything on the Caddy side is working correctly. It’s just that seafile isn’t getting the info it needs.

seafile.mydomain.com {
	reverse_proxy seafile:80
}

Is what I used to have and that works no problem to access the site.

as for the php your correct this confusion as to syntax and what is actually required.

Based on my research what I’m looking to have happen is when seafile calls for the picture to fill the avatar I need it to call

seafile.mydomain.com/media/avatars/

rather than

http://127.0.0.1:8000/media/avatars/

apparently with apache this can be achieved by adding

ProxyPreserveHost On

I just can’t figure out what the equivalent is for Caddy.

I’ve now tried

header_up Host {http.reverse_proxy.upstream.hostport}

and

  header_up -X-Forwarded-For
    header_up -X-Forwarded-Proto

and

header_up X-Forwarded-Host {seafile.mydomain.com}

Thanks again for your help. Apologies if I was not clear enough in my original query.

I did have a look at V2 Reverse Proxy Transparency which I think my be related.

That’s already Caddy’s default behaviour - it passes through the Host unmodified.

Ultimately you’ll need to find out what Seafile expects. You’ll need to ask the Seafile community for help here.

Ok perfect. I will head over there and see if they can help. I appreciate your time and help!

Merci Beaucoup.

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.