minus-squaregiopas@alien.topBtoSelf-Hosted Main@selfhosted.forum•Questions about caddy as an alternative to traefik, with docker, and docker-composelinkfedilinkEnglisharrow-up1arrow-down1·1 year agoHere is an example of a working Caddyfile to start from. In the first example (jelly.user.com), every query to http://jelly.user.com is automatically translated in https and handled over to http://192.168.1.10:7548. In the second instance, you do not use https (TLS) and every query to http://well.user.com is directly passed along to the service running under http://192.168.1.13:5960. Note that certificates are automatically handled and renewed by Caddy, giving your email address. I also added a log for each subdomain for convenience. I hope this is helpful. ~:/etc/caddy $ cat Caddyfile { log { output file /home/userCaddy-logs/caddy2.log } email [email protected] } jelly.user.com { log { output file /home/user/Caddy-logs/jelly.log } encode gzip header Strict-Transport-Security max-age1536000; reverse_proxy http://192.168.1.10:7548 } http://well.user.com { log { output file /home/user/Caddy-logs/well.log } encode gzip header Strict-Transport-Security max-age1536000; reverse_proxy http://192.168.1.13:5960 } linkfedilink
Here is an example of a working Caddyfile to start from.
In the first example (jelly.user.com), every query to http://jelly.user.com is automatically translated in https and handled over to http://192.168.1.10:7548.
In the second instance, you do not use https (TLS) and every query to http://well.user.com is directly passed along to the service running under http://192.168.1.13:5960.
Note that certificates are automatically handled and renewed by Caddy, giving your email address.
I also added a log for each subdomain for convenience.
I hope this is helpful.
~:/etc/caddy $ cat Caddyfile { log { output file /home/userCaddy-logs/caddy2.log } email [email protected] }
jelly.user.com { log { output file /home/user/Caddy-logs/jelly.log } encode gzip header Strict-Transport-Security max-age1536000; reverse_proxy http://192.168.1.10:7548 }
http://well.user.com { log { output file /home/user/Caddy-logs/well.log } encode gzip header Strict-Transport-Security max-age1536000; reverse_proxy http://192.168.1.13:5960 }