Struggle to route to subdomain

I am starting using Traefik and I a struggling to set it up. I am using docker-compose.

I have two subdomains pointing to the ip of my VPS with the following target

  • vps.labonnefabrique-point-fr (sorry I hit the limit of authorized url in a post): everything about the core vps, Traefik and something like dockProm to monitor the vps. For know, only traefik is setup and listening on 8080
  • graphql.labonnefabrique-point-fr : hasura graphql endpoind. The app exposes its ports to 8082

I read the docs and followed the tutorials of . I succeeded in making the example " My Application Listens on a Specific Port" to work.

But I am struggling to succeed in making my case working. Here is my docker-compose.yml

version: "3.3"

    image: "traefik:v2.0.1"
      - --entrypoints.web.address=:80
      - --providers.docker
      - --api.insecure
      - --providers.docker.endpoint=unix:///var/run/docker.sock
      - "80:80"
      - "8080:8080"
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
    image: postgres
    restart: always
     - "./db_data:/var/lib/postgresql/data"
    image: hasura/graphql-engine:v1.0.0
      - "8082:8080"
      - traefik.http.routers.graphql-engine.rule=Host(``)
      - "postgres"
    restart: always
      HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:@postgres:5432/postgres
      HASURA_GRAPHQL_ENABLE_CONSOLE: "true" # set to "false" to disable console
      HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log
      ## uncomment next line to set an admin secret
      # HASURA_GRAPHQL_ADMIN_SECRET: myadminsecretkey

What I expected is that http://vps.labonnefabrique-point-fr-:-8080 gets to the Traefik dashboard and graphql.labonnefabrique -point- fr gets to the graphql endpoint.

What I got:

  • get to Traefik dashboard but to the graphql end point
  • graphql.labonnefabrique -point- fr/ give a bad gateway error, leads to the graphql end point and to the Traefik dashboard.

I don't understand what is wrong with my config. Could someone point me to the right direction?


I made some progress by adding

exposedByDefault = false

now the graphql behave correctly. But still show Traefik console. How could I forbid this behavior?

With exposedByDefault = false you are not using traefik to expose graphql, so you can remove the traefik altogether for the same result: That is if you are using different ports for exposing stuff anyway, you do not need traefik.

Note that vps.labonnefabrique-point-fr does not appear in your config at all.

Thank you for your reply it made me think. I should have precised that I added traefik.enable=true in the graphql service. is dedicated to traefik and monitoring (to be added). I tried to put some labels in the traefik service but it messed the config.

Anyway, you're right, I have to assess if I really need Traefik and the added complexity.

This is a simple issue to resolve: Https redirection not working when providers.docker.exposedbydefault=false

Also, look at these compose files and see how "traefik.enable=true" is activated within services.