1. Caddy version:
v2.6.2 h1:wKoFIxpmOJLGl3QXoo6PNbYvGW4xLEgo32GPBEjWL8o=
2. How I installed, and run Caddy:
I am using lucaslorentz / caddy-docker-proxy (GitHub - lucaslorentz/caddy-docker-proxy: Caddy as a reverse proxy for Docker)
a. System environment:
Ubuntu HOST using Docker swarm
b. Command:
docker swarm starts caddy
c. Service/unit/compose file:
caddy:
image: lucaslorentz/caddy-docker-proxy:ci-alpine
ports:
- 80:80
networks:
- app_network
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- caddy_data:/data
deploy:
placement:
constraints:
- node.role == manager
replicas: 1
restart_policy:
condition: any
d. My complete Caddy config:
healthcheck.phppointofsale.com:80, http:// {
reverse_proxy 10.0.1.32 10.0.1.33 {
trusted_proxies private_ranges
}
}
*.phppointofsale.com:80, *.phppos.com:80 {
reverse_proxy 10.0.1.30 10.0.1.29 {
trusted_proxies private_ranges
}
}
*.phppointofsalestaging.com:80 {
reverse_proxy 10.0.1.18 10.0.1.17 {
trusted_proxies private_ranges
}
}
custom.phppointofsale.com:80, custom.phppos.com:80 {
reverse_proxy 10.0.1.25 10.0.1.24 {
trusted_proxies private_ranges
}
}
feedback.phppointofsale.com:80, feedback.phppos.com:80 {
reverse_proxy 10.0.1.51 10.0.1.52 {
trusted_proxies private_ranges
}
}
help.phppointofsale.com:80, help.phppos.com:80 {
reverse_proxy 10.0.1.39 10.0.1.40 {
trusted_proxies private_ranges
}
}
mysql.phppointofsale.com:80, mysql.phppos.com:80 {
reverse_proxy 10.0.1.15 10.0.1.14 {
trusted_proxies private_ranges
}
}
www.phppointofsale.com:80, www.phppos.com:80, phppointofsale.com:80, phppos.com:80 {
reverse_proxy 10.0.1.45 10.0.1.46 {
trusted_proxies private_ranges
}
}
www.phppointofsalestaging.com:80, phppointofsalestaging.com:80 {
reverse_proxy 10.0.1.4 10.0.1.3 {
trusted_proxies private_ranges
}
}
zatca.phppointofsale.com:80, zatca.phppos.com:80 {
reverse_proxy 10.0.1.57 10.0.1.54 {
trusted_proxies private_ranges
}
}
3. The problem I’m having:
-
I am trying to make a default fall back if it doesn’t match any other sites. All traffic routes to healthcheck.phppointofsale.com no matter the domain.
-
Is there a way to avoid putting :80? I have to do this because my server sites behind cloudflare and load balancer and load balancer is ssl terminated
I just want it to look clean with port. I know I can also do http://, but then I can’t do wildcards.
4. Error messages and/or full log output:
All traffic routes to healthcheck.phppointofsale.com
5. What I already tried:
- Removing healthcheck.phppointofsale.com. I believe it doesn’t like http://
If I remove entire healthcheck, http it routes to other sites well, but then I cannot have a default site
- Tried doing http:// for each site but doesn’t let me did wildcards