Configuration for multiple app

Hi !

I need some pointers :slight_smile:
Right now I have traefik installed and running on my DO with a subdomain
I also have an app (Blazegraph datatourisme / docker-stack ยท GitLab ) installed with docker.
This app makes available 3 urls :

  • serverip:9999/blazegraph/
  • serverip:8080/graphiql
  • serverip:8080/voyager

Now, I'd like to know if I can :

  • At least, use instead of serverip by using traefik (and how please :smiley: )
  • At best, use other subdomains for each urls (like my1.domain for serverip:9999/blazegraph/ , my2.domain for serverip:8080/graphiql ... )

Thanks a lot !

Hello @Mat !

You add host-based and pathprefix routes like:

- traefik.enable=true
- traefik.http.routers.SERVICENAME1.service=SERVICENAME1
- traefik.http.routers.SERVICENAME1.entrypoints=web
- traefik.http.routers.SERVICENAME1.rule=Host(`my1.domain`) && PathPrefix(`/blazegraph/`)
- traefik.enable=true
- traefik.http.routers.SERVICENAME2.service=SERVICENAME2
- traefik.http.routers.SERVICENAME2.entrypoints=web
- traefik.http.routers.SERVICENAME2.rule=Host(`my2.domain`) && PathPrefix(`/graphiql/`)

Greetings from Brazil!

1 Like

Thank you so much for your reply :slight_smile:
I feel pretty stupid but I don't understand where I have to add that.
I assume that I have to modify my traefik.toml, but I don't know where to start.

Right now it's the basic file :

    address = ":80"
      to = "websecure"
      scheme = "https"

    address = ":443"

  dashboard = true

  email = "mathieu@me"
  storage = "acme.json"

  watch = true
  network = "web"

  filename = "traefik_dynamic.toml"

I've tried to understand the doc but it's kinda hard to get it for me :slight_smile:

Should I had something like that at the end of the traefik.toml ?

  	traefik.enable = true = 9999
	traefik.http.routers.SERVICENAME1.service = SERVICENAME1
	traefik.http.routers.SERVICENAME1.entrypoints = web
	traefik.http.routers.SERVICENAME1.rule=Host(`my1.domain`) && PathPrefix(`/blazegraph/`)
	traefik.enable = true = 8080
	traefik.http.routers.SERVICENAME2.service = SERVICENAME2
	traefik.http.routers.SERVICENAME2.entrypoints = web
	traefik.http.routers.SERVICENAME2.rule=Host(`my2.domain`) && PathPrefix(`/graphql/`)

Thanks a lot !!

Don't feel stupid! Traefik is a relatively new tool and we are constantly learning. All of us, without exception!

Based on your stack available in gitlab, you could do it as follows.

version: '3.1'


    image: conjecto/blazegraph:2.1.5
    restart: always
    #  - 9999:9999
        JAVA_OPTS: "-Xms512m -Xmx1g"
      - ./dataset:/docker-entrypoint-initdb.d
      condition: any
    mode: global
    endpoint_mode: dnsrr
      constraints: [node.role == worker]
      delay: 2s
      - traefik.enable=true
      - traefik.http.routers.blazegraph.rule=Host(`my1.domain`) && PathPrefix(`/blazegraph/`)
      - traefik.http.routers.blazegraph.service=blazegraph
      # If you need sticky sessions, please uncomment below

      # Enable Secure Configuration
      - traefik.http.routers.blazegraph.tls=true
      - traefik.http.routers.blazegraph.entrypoints=websecure

      # Lets Encrypt Resolver
      - traefik.http.routers.blazegraph.tls.certresolver=lets-encrypt


It's possible to do somethink like your talking about over here, but add prefix for service2 in another service1 domain?

I mean, I got and, how I can add prefix for for looks like this: --> for redirected or opened by this link my second service at

@SoulAssassin Would you have a stack example for better understanding?


Here is one:

version: '3.9'

    container_name: homeassistant
      - /homeassistant:/config
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock
    restart: unless-stopped
    privileged: true
    network_mode: host
        condition: service_healthy
      test: ["CMD", "curl", "-f", ""]
      interval: 60s
      timeout: 30s
      retries: 6
      - diun.enable=true
      - com.centurylinklabs.watchtower.scope=watchtower-homeassistant
      - traefik.enable=true
      - traefik.http.routers.homeassistant.rule=Host(``)
      - traefik.http.routers.homeassistant.entrypoints=websecure
      - traefik.http.routers.homeassistant.tls=true
      - traefik.http.routers.homeassistant.tls.certresolver=myresolver

    container_name: homeassistant-vscode
    image: codercom/code-server:latest
      - /homeassistant:/home/coder/project
      - /vscode:/home/coder/.local/share/code-server
      - 8080:8443
    command: code-server --auth password --port 8443 --disable-telemetry /home/coder/project
    restart: unless-stopped
      - diun.enable=true
      - com.centurylinklabs.watchtower.scope=watchtower-system
      - traefik.enable=true
      - traefik.http.routers.homeassistant-vscode.rule=Host(``)
      #- traefik.http.routers.homeassistant-vscode.rule=Host(``) && PathPrefix(`/vscode/`)
      - traefik.http.routers.homeassistant-vscode.entrypoints=websecure
      - traefik.http.routers.homeassistant-vscode.tls=true
      - traefik.http.routers.homeassistant-vscode.tls.certresolver=myresolver
      #- traefik.http.routers.homeassistant-vscode.middlewares=custom_repath
      #- traefik.http.middlewares.custom_repath.replacepathregex.regex=^/$$
      #- traefik.http.middlewares.custom_repath.replacepathregex.replacement=/vscode
      #- traefik.http.routers.homeassistant-vscode.tls.certresolver=le

As u can see, two services, and, and when I open Home Assistant via https (, inside link to my vscode container get formatted like <-- so this is a qustion, how I can (if I can) add rule for maybe prefix or something else, with helped me to add additional path like for opens my vscode application. I hope I described it all clear. Thanks. :+1:

Perfect! I believe I understand.

So internally in your application there is already a redirect from / to /vscode

You can use redirectregex middleware and not placeregex.

Thanks, as I understood I need to put it in my vscode service right?

- traefik.http.middlewares.add-context.redirectregex.regex=^https:\\/\\/([^\\/]+)\\/?$$
- traefik.http.middlewares.add-context.redirectregex.replacement=https://$$1/vscode

Not working for me :expressionless: Maybe I do something wrong.

Yep, my finnaly path in home assistant is, but vscode get this own subdomain vsc..

I am pursuing goals:

  1. save its own domain
  2. add a prefix to my first service - where vscode will be available