I want to point via www.domain.ch to a path of the service in the docker container ('/service1'). I have already seen the redirect that /service1 then appears in the path, but actually I want traefik to do this mapping in the background. does anyone have a tip for me?
Thanks and greetings
André
Hello @nwc-ch,
For this, you need 2 things:
The first one is a service that can redirect requests to your docker container (with the IP of my-container
) to the path /service1
.
http:
services:
my-service:
loadBalancer:
servers:
- url: "http://my-container/service1"
The second one is a router to handle incoming requests. This router has a rule that match all requests with a Host
of www.domain.ch
.
http:
routers:
my-router:
rule: "Host(`www.domain.ch`)"
service: my-service
Now, if you have a request that comes to traefik with a host of www.domain.ch
, traefik will redirect it to http://my-container/service1
.
PS, all of there is done using the file provider.
WDYT ?
1 Like