Caddy is not forwarding request to nginx container

1. Caddy version:

v2.3.0 h1:fnrqJLa3G5vfxcxmOH/+kJOcunPLhSBnjgIvjXV/QTA=

2. How I installed, and run Caddy:

docker image: caddy:2.3.0-alpine

a. System environment:

OS: Ubuntu 22.04.1 LTS x86_64
Docker version 20.10.22, build 3a2c30b
docker-compose version 1.29.2, build unknown

b. Command:

docker-compose up

c. docker-compose.yaml file:

version: '3'
    image: caddy:2.3.0-alpine
      - "80:80"
      - ./Caddyfile:/etc/caddy/Caddyfile
    image: nginx:latest
      - "8080"
    image: httpd:latest
      - "8081"

d. My complete Caddy config:

hostname:80 {
    reverse_proxy service1:8080
    reverse_proxy service2:8081

3. The problem I’m having:

I am implementing reverse proxy using caddy in docker container. i have docker-compose file in which i specifed three service caddy, nginx, httpd. i also configured caddyfile in which i redirected my request to servers. when i run ‘$docker-compose up’ all the containers working perfectlly fine. but when i go to

http://localhost/ - show blank white page
http://localhost:8080/ - this site cant be reach
http://localhost:8081/ - this site cant be reach
nginx_container_IP - show nginx page
httpd_container_IP - show httpd page


{"level":"info","ts":1675247772.029432,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"} {"level":"info","ts":1675247772.033348,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["localhost:2019","[::1]:2019",""]} {"level":"info","ts":1675247772.033649,"logger":"http","msg":"server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server","server_name":"srv0","http_port":80} {"level":"info","ts":1675247772.0337453,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc0002f52d0"} {"level":"info","ts":1675247772.0342908,"logger":"tls","msg":"cleaned up storage units"} {"level":"info","ts":1675247772.034485,"msg":"autosaved config","file":"/config/caddy/autosave.json"} {"level":"info","ts":1675247772.0345104,"msg":"serving initial configuration"}

6. Links to relevant resources:


That’s a very old version of Caddy. Please upgrade to v2.6.2.

Please mind your post’s formatting. Read the instructions in the template. Config and logs should go within fenced code blocks, i.e. ``` sections.

Please don’t leave any sections of the template blank.

Make sure you’ve read the docs. Your question will probably be answered there. Read the tutorials.

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