Confused about internal services

Hello,
when setting up a new Traefik instance (dashboard access), I've always just pasted in what worked the first time and haven't given it much thought (i.e. the following router).

traefik-dashboard:
      entryPoints: ["https"]
      rule: "Host(`traefik.domain.com`)"
      tls: {}
      service: api@internal

Now I'm wondering, though, there are two internal services that confuse me - the api@internal and dashboard@internal. My thought process is that the API service would be used for the HTTP API and the dashboard one to display the dashboard. When I change out the api@internal for dashboard@internal, I get the application but no data. The AJAX requests it's making are directed to the current URL with the API endpoint appended, but the API is no longer being served at /api.

So, let's say I wanted to have the dashboard at traefik.domain.com and the API at api.traefik.domain.com (usage -> api.traefik.domain.com/entrypoints). How would one achieve that?

Note that I never actually used the API and I don't think I ever will. This is more of a hypothetical question as I want to understand Traefik beyond an "I'm able to add a router" knowledge.

Thank you

You are probably the first person going down that path :wink:

Usually api and dashboard go together, as in doc:


# Dynamic Configuration
labels:
  - "traefik.http.routers.dashboard.rule=Host(`traefik.example.com`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))"
  - "traefik.http.routers.dashboard.service=api@internal"
  - "traefik.http.routers.dashboard.middlewares=auth"
  - "traefik.http.middlewares.auth.basicauth.users=test:$$apr1$$H6uskkkW$$IgXLP6ewTrSuBkTrqE8wj/,test2:$$apr1$$d9hr9HBB$$4HxwgUir3HP4EsggP/QNo0"

There is no way to even set a different path for /dashboard, so I doubt there will be a way to tell it to use a different host for api requests.

Alright, I’m glad I didn’t miss anything. I was just wondering why they’re split and I only ever see people use the api not the dashboard service.