Are we able to set automatic_https/skip in Caddyfile?

1. Caddy version (caddy version):

caddy version
v2.4.3 h1:Y1FaV2N4WO3rBqxSYA8UZsZTQdN+PwcoOcAiZTM8C0I=

2. How I run Caddy:

    restart: always
    image: caddy:2.4.3-alpine
      - ./caddy/Caddyfile:/etc/caddy/Caddyfile
      - ./caddy/data:/data
      - ./caddy/certificate.pem:/etc/ssl/certs/certificate.pem
      - ./caddy/key.pem:/etc/ssl/private/key.pem
      - 80:80
      - 443:443

a. System environment:

docker -v
Docker version 20.10.7, build f0df350
docker-compose -v
docker-compose version 1.29.2, build 5becea4c

b. Command:

docker-compose up

c. Service/unit/compose file:

Paste full file contents here.
Make sure backticks stay on their own lines,
and the post looks nice in the preview pane.

d. My complete Caddyfile or JSON config:

:80 {
        reverse_proxy http://test.tld

3. The problem I’m having:

Internet => server:80 => caddy => network => test.tld (GitHub - lucaslorentz/caddy-docker-proxy: Caddy as a reverse proxy for Docker)

  1. I have a server on the internet exposing 80 and 443
  2. The server is running the docker-compose containing a caddy service.
  3. I am running test.tld on the same network where the server can reach to

Here is the curl log from the server

curl -I http://test.tld
HTTP/1.1 200 OK
Content-Length: 6732
Content-Type: text/html; charset=utf-8
Date: Fri, 18 Mar 2022 22:27:40 GMT
Etag: "1a4c-Hw+mSj4DXKG3tnL9Oj87rYJSiH0"
Server: Caddy
Vary: Accept-Encoding
X-Powered-By: Next.js 

It seems test.tld (served by GitHub - lucaslorentz/caddy-docker-proxy: Caddy as a reverse proxy for Docker) can access by HTTP, but when I access from the internet side, it redirects to HTTPS

When I compared config json file, test.tld side has

"automatic_https": { "skip": ["test.tld"] }

but the server side caddy do not have this.

How can I set the above config through just Caddyfile?

4. Error messages and/or full log output:

5. What I already tried:

6. Links to relevant resources:

Hi :slight_smile:

  1. Please update to v2.4.6 (Docker: caddy:2.4.6-alpine).

  2. If you are using GitHub - lucaslorentz/caddy-docker-proxy: Caddy as a reverse proxy for Docker, could you please share your docker labels too?

  3. To disable http → https redirects, you can opt to disable them in Caddy’s global options:
    Global options (Caddyfile) — Caddy Documentation via auto_https disable_redirects or auto_https off. But your shared Caddyfile won’t redirect to https anyway? I am afraid I don’t fully understand what you are trying to do.

  4. Please keep in mind, that disabling secure http (https) is generally a terrible idea, because it is… well, insecure.


This was what I was trying to do. Tailscale part aside, I was just trying to reverse_proxy from a caddy to another caddy like that.

I then figured that I didn’t have to use caddy on the end IF I used network_mode: host and specify a port to connect.

# or just use ports ...
    # network_mode: host
      - 8080:3000

Caddyfile {
  reverse_proxy http://test.tld:8080

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