Reverse Proxy Unavailable

1. Caddy version (caddy version):

Caddy Version: 2 + Cloudflare Plugin

2. How I run Caddy:

a. System environment:

Docker

b. Command:

docker-compose up -d

c. Service/unit/compose file:

version: "3.7"

services:
  caddy:
    build: .
    restart: unless-stopped
    environment:
      CLOUDFLARE_EMAIL: 
      CLOUDFLARE_API_TOKEN:
    ports:
      - "4443:443/tcp"
    volumes:
      - ./caddyfile:/etc/caddy/Caddyfile

d. My complete Caddyfile or JSON config:

{
	email {env.CLOUDFLARE_EMAIL}
	acme_dns cloudflare {env.CLOUDFLARE_API_TOKEN}
	auto_https disable_redirects
	https_port 443
}

sub.domain.country {
	reverse_proxy http://192.168.1.2:1005
        handle_errors {
	      respond "{http.error.status_code} Service unavailable."
        }
}
sub.domain.country {
	reverse_proxy https://192.168.1.2:1006 {
                transport http {
                        tls_insecure_skip_verify
                }
        }
}

3. The problem I’m having:

Hello guys,

I have a question. I have a lot of reverse proxy entries. Something I would like is to provide a webpage or at least a message if a reverse proxy origin is unavailable.

4. Error messages and/or full log output:

As described at the next topic, the supposed solution did not work.

5. What I already tried:

I went searching and found handle_errors assuming that unavailability would provide an error code.

6. Links to relevant resources:

What do you mean “did not work”? What behaviour did you see instead?

Please make sure to persist /data and /config as volumes, as described in the docs on Docker Hub. It’s necessary to persist the certs and keys you’ve had issued from ACME CAs, and to persist important state that Caddy writes to disk.

How are you building Caddy exactly? What does your Dockerfile look like?

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