💻 Tech
In docker-compose, if you have services that are accessed by other services, you need to use the service name as hostname instead of localhost. Internally, the service name is resolved to the IP address used by the service in docker-compose.
However, if the UI service is accessed by a web browser and queries another service like backend server, the hostname must be localhost as the browser cannot resolve the service name to the right IP address.