Need help, keep getting 502 Bad Gateway

1. My Caddy version (caddy -version):

abiosoft/caddy latest

2. How I run Caddy:

docker-compose up -d

a. System environment:

OS, relevant versions, systemd? docker? etc.

digitalocean droplet > Ubuntu 18.04

my main site docker-compose.yml:

version: β€˜3.7’
services:
cp:
image: antmanx2/cp
restart: on-failure
networks:
- cp-network
ports:
- 8080:80

caddy:
image: abiosoft/caddy
restart: on-failure
volumes:
- /etc/Caddyfile:/etc/Caddyfile
- /etc/.caddy:/root/.caddy
networks:
- cp-network
ports:
- 80:80
- 443:443
networks:
cp-network:
external: true

d. My complete Caddyfile:

computerpassion.net {
tls anthonyf@computerpassion.com
proxy / localhost:8080 {
transparent
}
}

3. The problem I’m having:

I have tried everything I could google but I always get a gateway issue, 502.

4. Error messages and/or full log output:

No errors, just when navigating to my site I get:
502 Bad Gateway valid ssl certificate though

5. What I already tried:

Disabling the UFW firewall, multiple iterations of my Caddyfile etc.

6. Links to relevant resources:

Thank you for your help, I am new to all of this.

Hi Anthony. Welcome to the Caddy community!

Your Caddyfile is trying to proxy to localhost:8080, but your upstream isn’t on localhost. Your upstream is cp:80.

2 Likes

@Mohammed90 YOU sir are my hero! thank you so very much, I had no idea it worked that way!

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