I am using traefik as a reverse proxy that routes HTTP requests to the according container by matching the request domain.
Let’s say I have the following containers:
- apiContainer (as
- frontendContainer (as
I can access both containers via the reverse proxy from my host machine.
Now i want to send HTTP requests from frontendContainer to
This used to work a year ago with:
# frontendContainer/docker-compose.yml services: frontendContainer: networks: traefik_default: aliases: - api.local
docker exec frontendContainer ping api.local returns
127.0.0.1 instead of
traefiks IP address.
All I want, is to send an HTTP request from frontendContainer to apiContainer via traefikContainer by addressing
How can this be achieved?
htp instead of
http to circumvent post restrictions)
I found a workaround:
services: frontendContainer: extra_hosts: - "api.local:host-gateway"
This way, the request will be routed to the host system, from which the reverse proxy is reachable.