1. Caddy version (caddy version
):
v2.4.0-beta.2
2. How I run Caddy:
a. System environment:
Docker container built from builder-alpine official image with Cloudflare module.
b. Command:
Don’t know, it’s baked into the official Docker image. But here is my Dockerfile:
FROM caddy:builder-alpine AS builder
RUN xcaddy build \
--with github.com/caddy-dns/cloudflare
FROM caddy:alpine
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
c. Service/unit/compose file:
version: "3.9"
services:
caddy:
container_name: caddy
image: rafaelagp/caddy-cloudflare
user: 1001:100
volumes:
- /mnt/solid/config/caddy:/config
- /mnt/solid/config/caddy:/data/caddy
- /mnt/solid/config/caddy/Caddyfile:/etc/caddy/Caddyfile
ports:
- 80:80
- 443:443
- 10001:10001
network_mode: "bridge"
restart: unless-stopped
d. My complete Caddyfile or JSON config:
Sorry for redacting but I do not want my domain made public.
{
debug
acme_dns cloudflare api_token
email email@domain
}
server:80 {
reverse_proxy 192.168.1.3:8002
}
yacht:80 {
reverse_proxy 192.168.1.3:8001
}
transmission:80 {
reverse_proxy 192.168.1.3:9091
}
jackett:80 {
reverse_proxy 192.168.1.3:9117
}
radarr:80 {
reverse_proxy 192.168.1.3:7878
}
sonarr:80 {
reverse_proxy 192.168.1.3:8989
}
emby:80 {
reverse_proxy 192.168.1.3:8096
}
https://emby.domain:10001 {
reverse_proxy 192.168.1.3:8920 {
header_up X-Real-IP {remote_host}
}
encode gzip
header / {
Strict-Transport-Security "max-age=31536000;"
X-XSS-Protection "1; mode=block"
X-Frame-Options "DENY"
X-Robots-Tag "none"
-Server
}
}
3. The problem I’m having:
Can’t access Emby remotely through Caddy’s reverse proxy.
4. Error messages and/or full log output:
Again, sorry for redacting IPs and domain:
{
"level": "debug",
"ts": 1618770361.4402223,
"logger": "http.handlers.reverse_proxy",
"msg": "upstream roundtrip",
"upstream": "192.168.1.3:8920",
"request": {
"remote_addr": "mobile_phone_ip:60962",
"proto": "HTTP/2.0",
"method": "GET",
"host": "emby.domain:10001",
"uri": "/",
"headers": {
"Accept": [
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
],
"X-Real-Ip": [
"mobile_phone_ip"
],
"Sec-Fetch-Mode": [
"navigate"
],
"X-Forwarded-For": [
"mobile_phone_ip"
],
"Save-Data": [
"on"
],
"X-Forwarded-Proto": [
"https"
],
"User-Agent": [
"Mozilla/5.0 (Linux; Android 11; SM-G973F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.66 Mobile Safari/537.36"
],
"Sec-Fetch-Site": [
"none"
],
"Cookie": [
"__cfduid=df3e2dd3ad9ecad0dc7a8d03fe7faddd81618721715"
],
"Accept-Encoding": [
"gzip, deflate, br"
],
"Sec-Fetch-Dest": [
"document"
],
"Sec-Ch-Ua": [
"\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"90\", \"Google Chrome\";v=\"90\""
],
"Accept-Language": [
"en-US,en;q=0.9,pt;q=0.8,fr;q=0.7"
],
"Sec-Fetch-User": [
"?1"
],
"Upgrade-Insecure-Requests": [
"1"
],
"Sec-Ch-Ua-Mobile": [
"?1"
],
"Purpose": [
"prefetch"
]
},
"tls": {
"resumed": false,
"version": 772,
"cipher_suite": 4865,
"proto": "h2",
"proto_mutual": true,
"server_name": "emby.domain"
}
},
"duration": 0.001930143,
"error": "EOF"
}
{
"level": "error",
"ts": 1618770361.4403605,
"logger": "http.log.error",
"msg": "EOF",
"request": {
"remote_addr": "mobile_phone_ip:60962",
"proto": "HTTP/2.0",
"method": "GET",
"host": "emby.domain:10001",
"uri": "/",
"headers": {
"Purpose": [
"prefetch"
],
"Sec-Fetch-Site": [
"none"
],
"Sec-Fetch-Mode": [
"navigate"
],
"Sec-Fetch-Dest": [
"document"
],
"Cookie": [
"__cfduid=df3e2dd3ad9ecad0dc7a8d03fe7faddd81618721715"
],
"Sec-Ch-Ua-Mobile": [
"?1"
],
"User-Agent": [
"Mozilla/5.0 (Linux; Android 11; SM-G973F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.66 Mobile Safari/537.36"
],
"Accept": [
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
],
"Sec-Ch-Ua": [
"\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"90\", \"Google Chrome\";v=\"90\""
],
"Accept-Language": [
"en-US,en;q=0.9,pt;q=0.8,fr;q=0.7"
],
"Save-Data": [
"on"
],
"Sec-Fetch-User": [
"?1"
],
"Accept-Encoding": [
"gzip, deflate, br"
],
"Upgrade-Insecure-Requests": [
"1"
]
},
"tls": {
"resumed": false,
"version": 772,
"cipher_suite": 4865,
"proto": "h2",
"proto_mutual": true,
"server_name": "emby.domain"
}
},
"duration": 0.002249738,
"status": 502,
"err_id": "sy77gwcj2",
"err_trace": "reverseproxy.statusError (reverseproxy.go:843)"
}
5. What I already tried:
- I’ve got the port (10001) forwarded to the server in my router.
- I’ve tried forwarding straight to Emby (8920), and it works, I can access it from my mobile phone’s data connection (not wifi), which points the problem at the reverse proxy configuration.
- I’ve tried replacing the reverse proxy LAN IP for the Docker network IP with no change in response.
- I’ve tried removing all directives but the reverse proxy with no change in response.
- I’ve successfully ping’ed both the LAN IP and the Docker network IP for Emby from within Caddy’s container, so I know it’s reachable.
6. Links to relevant resources:
None yet.