Calibre-web giving 502 error behind Caddy

1. The problem I’m having:

‘’’ I had to reinstall Calibre-Web and used a full VM instead of my container (which it was working on previously). I can access it via VPN/IP address, however, I can’t connect it via DNS behind caddy. Was wondering if anyone knows what might be the hangup. Other services such as Nextcloud are currently resolving just fine.‘’’

2. Error messages and/or full log output:

May 01 19:21:22 Caddy caddy[139]: USER=caddy
May 01 19:21:22 Caddy caddy[139]: INVOCATION_ID=eef2611ef58b4fd38db8b5f3fe1d4bc6
May 01 19:21:22 Caddy caddy[139]: JOURNAL_STREAM=9:345528717
May 01 19:21:22 Caddy caddy[139]: {"level":"info","ts":1682968882.0369937,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
May 01 19:21:22 Caddy caddy[139]: {"level":"warn","ts":1682968882.043112,"msg":"Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":12}
May 01 19:21:22 Caddy caddy[139]: {"level":"info","ts":1682968882.047752,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//[::1]:2019","//127.0.0.1:2019","//localhost:2019"]}
May 01 19:21:22 Caddy caddy[139]: {"level":"info","ts":1682968882.050886,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc0000c7c00"}
May 01 19:21:22 Caddy caddy[139]: {"level":"info","ts":1682968882.0515363,"logger":"http","msg":"server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS","server_name":"srv0","https_port":443}
May 01 19:21:22 Caddy caddy[139]: {"level":"info","ts":1682968882.052577,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
May 01 19:21:22 Caddy caddy[139]: {"level":"info","ts":1682968882.0563369,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/var/lib/caddy/.local/share/caddy"}
May 01 19:21:22 Caddy caddy[139]: {"level":"info","ts":1682968882.0640976,"logger":"tls","msg":"finished cleaning storage units"}
May 01 19:21:22 Caddy caddy[139]: {"level":"info","ts":1682968882.064598,"logger":"http","msg":"enabling HTTP/3 listener","addr":":443"}
May 01 19:21:22 Caddy caddy[139]: {"level":"info","ts":1682968882.0656855,"logger":"tls.cache.maintenance","msg":"stopped background certificate maintenance","cache":"0xc0000c7c00"}
May 01 19:21:22 Caddy caddy[139]: Error: loading initial config: loading new config: http app module: start: listen udp :443: bind: address already in use
May 01 19:21:22 Caddy systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
May 01 19:21:22 Caddy systemd[1]: caddy.service: Failed with result 'exit-code'.
May 01 19:21:22 Caddy systemd[1]: Failed to start Caddy.

3. Caddy version:

2.6.4

4. How I installed and ran Caddy:

Installed via the instructions on the website

a. System environment:

Ubuntu 22.04 container running via Proxmox

b. Command:

Caddy runs at bootup

d. My complete Caddy config:

calibre.sampledomain.com {
    reverse_proxy 192.168.1.106:8083 {
        header_up X-Scheme https
    }
}

This seems like another server is already running. Did you run Caddy twice? Did you run caddy start? If so, make sure to shut down all instances of Caddy, then only start the systemd service.

A 502 means that Caddy couldn’t connect to the upstream. Make sure your networking is correct between Caddy and the upstream app. Are you sure they’re both in the same network and Caddy can connect to it?

So I rebooted the Caddy server to make sure there was only one instance of Caddy running. I also tried changing the port to see if that would help, but no dice.

They are on the same network and my Caddy server can ping the server hosting Calibre.

The weird thing is that this worked fine when I was hosting Calibre-web on a container, with all the same settings in my caddyfile. Once I switched it to a VM it stopped resolving correctly.

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