1. Caddy version (caddy version
): 2 (migrating from abiosoft/caddy)
2. How I run Caddy:
a. System environment:
Docker on Ubuntu 20.04
b. Command:
docker-compose up
c. Service/unit/compose file:
Caddyfile for v1
version: '3.3'
services:
# Pull Caddy 1 (deprecated)
caddy:
volumes:
- '/var/caddy/Caddyfile:/etc/Caddyfile'
- '/var/caddy:/root/.caddy'
- '/var/discourse/shared/web-only:/sock'
ports:
- '80:80'
- '443:443'
- '80:80/udp'
- '443:443/udp'
restart: always
container_name: caddy
entrypoint:
- /usr/bin/caddy
command: -quic --conf /etc/Caddyfile
image: abiosoft/caddy
Caddyfile for v2
version: '3.3'
services:
# Build Caddy 2
caddy:
volumes:
- '/var/caddy/Caddyfile:/etc/Caddyfile'
- '/var/caddy:/root/.caddy'
- '/var/discourse/shared/web-only:/sock'
- '/var/caddy/data:/data'
- '/var/caddy/config:/config'
ports:
- '80:80'
- '443:443'
- '80:80/udp'
- '443:443/udp'
restart: always
container_name: caddy
build: ./
restart: always
d. My complete Caddyfile or JSON config:
forum.xxxxxxxx.com
tls [email address]
proxy / unix:/sock/nginx.http.sock {
transparent
}
# forum.xxxxxxxx.com
# tls {
# dns cloudflare {$API-Key}
# }
# proxy / unix:/sock/nginx.http.sock {
# transparent
# }
Dockerfile
FROM caddy:2.0.0-builder AS builder
RUN caddy-builder \
github.com/caddy-dns/cloudflare
FROM caddy:2.0.0
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
3. The problem I’m having:
I’m trying to move my Discourse forum from Caddy v1 to v2. The files above are the exact files, and I’m commenting out the old/new config in docker-compose.yml
and Caddyfile
to go back and forth. Everything works fine with the v1 config and pulling from abiosoft/caddy. When I switch to the v2 config, I get the slanted page and ."server is listening only on the HTTP port
" error.
The endgame is to enable Cloudflare (proxying) for the domain, and add the API key. But currently, the domain is not proxied, and I’m just trying to get the basic config working the same way it’s working on v1 before adding Cloudflare to the party.
4. Error messages and/or full log output:
root@dev:/var/caddy# docker-compose up
Creating network "caddy_default" with the default driver
Creating caddy ... done
Attaching to caddy
caddy | {"level":"info","ts":1593135272.8524568,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}
caddy | {"level":"info","ts":1593135272.8594737,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["localhost:2019","[::1]:2019","127.0.0.1:2019"]}
caddy | {"level":"info","ts":1593135272.870425,"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}
caddy | {"level":"info","ts":1593135272.8706589,"logger":"tls","msg":"cleaned up storage units"}
caddy | 2020/06/26 01:34:32 [INFO][cache:0xc0003efa90] Started certificate maintenance routine
caddy | {"level":"info","ts":1593135272.872339,"msg":"autosaved config","file":"/config/caddy/autosave.json"}
caddy | {"level":"info","ts":1593135272.872394,"msg":"serving initial configuration"}
Error page in Firefox when attempting to load https://…
Secure Connection Failed
An error occurred during a connection to forum.xxxxxxxx.com. PR_CONNECT_RESET_ERROR
* The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
* Please contact the website owners to inform them of this problem.
5. What I already tried:
It seems that the v2 Docker image builds properly from the Dockerfile
. It goes through the process with no error output.
I’ve fiddled around with formatting in Caddyfile
and docker-compose.yml
. I also tried setting tls to internal to see if perhaps it was an acme error. Partly what’s confusing me is the error about the server only listening on http/80, when it’s working on https in Caddy v1.
Going back and forth between the v1 and v2 configs (Caddyfile and docker-compose.yml) yields the same results each time: v1 works, and v2 slanted page.
6. Links to relevant resources:
My Caddyfile
is basically my working v1 file with attempts to integrate these two other forum thread: