1. Caddy version:

V2.5.2 (use old version because of SSL issues with latest version, but I don’t want to solve this issue,… it’s too much work for me)
You can check this issue with caddy 2.5.2 and this guide:

Same posteo with latest caddy 2.6.4 (docker)

2. How I installed, and run Caddy:


a. System environment:

Debian 11

b. Command:

c. Service/unit/compose file:

Caddy docker-compose.yml

version: "3.7"

    driver: bridge

    image: caddy:latest
   #image: caddy:2.5.2
    container_name: caddy-proxy
    restart: always
      - "80:80"
      - "443:443"
      - /dockerdata/caddy/Caddyfile:/etc/caddy/Caddyfile
      - ./data:/data
      - ./config:/config
      - ./www:/srv
      - "com.centurylinklabs.watchtower.enable=false"
    mem_limit: 150m


Caddyfile: {
        reverse_proxy http://mailserver:80

Poste_io docker-compose.yml:

version: "3"

    image: analogic/
    container_name: mailserver
    hostname: mail
      #- "80:80"    # Webmail/Admin
      - "25:25"    # SMTP  (explicit TLS => STARTTLS)
      - "465:465"  # ESMTP (implicit TLS)
      - "587:587"  # ESMTP (explicit TLS => STARTTLS)
      - "143:143"  # IMAP4
      - "993:993"  # IMAP4 (implicit TLS)
      - ./mail:/data
      - ./mail/webmail/plugins:/opt/www/webmail/plugins
      - ./mail/webmail/config:/opt/www/webmail/config
      - /etc/localtime:/etc/localtime:ro
      - TZ=Europe/Berlin
      - HTTPS=OFF
      - VIRTUAL_PORT=80
    restart: always

Now I create a network “caddyposteo” (prefer ip without network but this doesnt work)
docker network create caddyposteo
connect booth caddy and posteo together

Now I can reach https URL/admin with ssl from caddy container.
After configuring admin pannel and switch to https URL/webmail I receive 500 error.
In poste_io documentation they wrote I should forward .well-known to poste_io docker container,… but I had no success.

A working config is this one:
(It’s for a old caddy version)

d. My complete Caddy config:

3. The problem I’m having:

Posteio has a integrated nginx with cert generation via le . The issue is, it works standalone via 80/443 but I did not find a way to create a working Caddyfile (for caddy2).

I tried in docker from posteio port change and so on but all without success.

Receive always 500/502

I would like to proxy_redirect to via ip and port and not via connected network (so no https://mailserver:443, would like to do it like vaultwarden via ip and port.)

4. Error messages and/or full log output:

5. What I already tried:

=> documentation

6. Links to relevant resources:

That’s an old version – please upgrade to the latest, v2.6.4.

Please completely fill out the help topic template, as per the forum rules. It’s necessary so that we can properly help you.

What issues? You’ll need to elaborate.

A 500 error is a problem with the upstream app, not Caddy.

Caddy handles all /.well-known/acme-challenge requests itself because it is itself an ACME client.

You didn’t post your logs for Caddy. Please do so, it’s necessary to understand what’s going on.

That 500 status error is coming from upstream, not from Caddy.

This is pretty clearly telling you the PHP code wasn’t successful because of a problem with your DB config.

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