1. My Caddy version (caddy version
):
docker caddy/caddy (v2)
2. How I run Caddy:
Using docker on my linux server. I also have dnsMasq running on my router, so requests for my custom “home” domain are redirected there.
a. System environment:
Debian.
b. Command:
docker compose up -d
c. Compose file:
version: "3.7"
services:
caddy:
image: "caddy/caddy"
container_name: "caddy"
hostname: "caddy"
restart: unless-stopped
ports:
- "80:80"
- "443:443"
environment:
- MY_DOMAIN
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- ./data:/data
- ./config:/config
networks:
default:
external:
name: $DEFAULT_NETWORK
d. My complete Caddyfile or JSON config:
http://a.home {
reverse_proxy / http://192.168.1.133:1880 {
}
}
3. The problem I’m having:
I must preface this : I’m a huge newbie, I have little to zero IT background, so please forgive me if what I’m asking is absurd.
I’m running several services in docker containers for my personal use at home. For example, I have Nodered running and I can access it at http://192.168.1.133:1880.
Since I have many services, I often get confused by urls. First world problem I know, but in any case I’d like to solve the issue using http://nodered.home instead of the current address.
Before posting here, I’ve googled my issue many times, but there seems to be as many approches as there are people posting about similar issues … and I’m getting confused.
Now, I have setup my router as such it redirects the request made to domain “home” to my server (192.168.1.133).
With caddy running I cand do $ curl http://a.home
and it gives me
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<title>Node-RED</title>
......
</body>
</html>
So I guess this is a good sign … until I try using my laptop (chrome) and I get a ERR_CONNECTION_REFUSED error when typing http://a.home. I can still access my container using http://192.168.1.133:1880
4. Error messages and/or full log output:
2020/05/06 10:18:52 [INFO][cache:0xc000018140] Started certificate maintenance routine
{"level":"info","ts":1588760332.583447,"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":1588760332.584713,"logger":"tls","msg":"cleaned up storage units"}
{"level":"info","ts":1588760332.5852015,"msg":"autosaved config","file":"/config/caddy/autosave.json"}
{"level":"info","ts":1588760332.5852308,"msg":"serving initial configuration"}
5. What I already tried:
- Using docker service name instead of the IP (ex: nodered:1880 instead of 192.168.1.133:1880).
- Making sure that I’m not using https to avoid errors linked to the custom domain name.
- Read posts on this forum about similar cases.
- Googled the issue several times.
Does my problem makes sense ? What am I missing if that’s the case ?
Thanks for any help you can provide !