Home Explore Blog CI



docker

5th chunk of `content/guides/traefik.md`
eaca86a8179ad886cf381aec7a39d475b8d24cf6be6490b300000001000002d8


To accomplish this, Traefik will need to use another method to configure itself. The [File provider](https://doc.traefik.io/traefik/providers/file/) lets you define the routing rules in a YAML document. Here is an example file:

```yaml
http:
  routers:
    native-api:
      rule: "Host(`localhost`) && PathPrefix(`/api`)"
      service: native-api
    native-client:
      rule: "Host(`localhost`)"
      service: native-client

  services:
    native-api:
      loadBalancer:
        servers:
          - url: "http://host.docker.internal:3000/"
    native-client:
      loadBalancer:
        servers:
          - url: "http://host.docker.internal:5173/"

Title: Routing Traffic to Non-Containerized Workloads Using Traefik's File Provider
Summary
To route traffic to applications running natively on the host machine, Traefik can be configured using the File provider. This involves defining routing rules in a YAML file. The example shows how to route requests to 'localhost/api' to port 3000 and 'localhost' to port 5173 using `host.docker.internal`.