Comment on How to reach different services via name instead of ip?
mech@feddit.org 3 days ago
To do this properly, you’ll need to set up a reverse proxy that publishes your different ports on different IP addresses.
Then you can use DNS or (locally) a hosts file for name resolution.
frongt@lemmy.zip 3 days ago
Yes, reverse proxy, but you don’t want to publish on different IP addresses. Your services should bind to one IP, different ports, and the reverse proxy accepts it all on 443 and routes it based on the host header.
I use traefik for this, set labels in the docker compose and it Just Works. It also gets certs for me based on the acme DNS challenge. Some people use caddy instead of traefik and they seem happy with it.
Tanoh@lemmy.world 3 days ago
Ideally the services should only bind to localhost and not 0.0.0.0 or similar as well. Allowing both proxied and non-proxied requests will 99/100 times cause problems, and then one time it doesn’t it is just confusion for no benefit.