I'm using Traefik v3 in a Docker Swarm environment and I need to forward a subdomain (e.g., api.mydomain.com
) to an external Nginx server running on localhost:8080
.
Since this Nginx instance is running directly on the host machine, and not inside a container, I need to ensure Traefik can properly route traffic to it.
i've try something like this:
proxy-to-host:
image: alpine
command: tail -f /dev/null
deploy:
replicas: 1
labels:
- "traefik.enable=true"
- "traefik.http.routers.proxy-to-host.rule=Host(`api.mydomain.com`)"
- "traefik.http.routers.proxy-to-host.entrypoints=web"
- "traefik.http.services.proxy-to-host.loadbalancer.server.url=http://host.docker.internal:8080"