CheckMK behind Traefik reverse proxy in subpath

CMK version: raw
OS version: docker 2.2.0-latest

Hi,

I am trying to make CheckMK work behind Traefik reverse proxy, in a subpath.
For example, instead of running in my.site.com/ I want it in my.site.com/mypath/.

i have read similar posts here, but they are mainly using Apache, and so I was not able to make it work.

Usually for Traefik with Docker, it suffices to:

    labels:
      - "traefik.enable=true"
      - "traefik.http.services.checkmk.loadbalancer.server.port=5000"
      - "traefik.http.services.checkmk.loadbalancer.server.scheme=http"
      - "traefik.http.routers.checkmk.rule=Host(`my.site.com`) && PathPrefix(`/mypath`)"
      - "traefik.http.routers.checkmk.entrypoints=web"
      - "traefik.http.routers.checkmk.middlewares=checkmk"
      - "traefik.http.middlewares.checkmk.stripprefix.prefixes=/mypath"

But it is not working: all urls and redirects returned by CheckMK do not contain mypath.
Is there a config I can use to tune this behavior?

Tank you,
regards

I was trying to find my old Checkmk Swarm yaml but I seem to have deleted it. But here is what i used for some other things back when I used Traefik + Docker Swarm. I believe I mostly just copied and pasted from each yaml I had. This configuration actually automatically went to the site made with the docker container eg checkmk.example.com with site cmk would automatically resolve and go to checkmk.example.com/cmk/. Hope this helps

labels:
- “traefik.enable=true”
- “traefik.http.routers.checkmk.rule=Host(checkmk.example.com)”
- “traefik.http.routers.checkmk.entrypoints=websecure”
- “traefik.http.routers.checkmk.tls.certresolver=letsencryptresolver”
- “traefik.http.services.checkmk.loadbalancer.server.port=5000”

Hi,

thank you for the answer.
I am able to expose checkmk behind traefik, but I am not able to expose it under a subpath.
Meantime I have somewhere that it seems impossible right now… a sad missing feature.

So I am going to close this for now…

Regards

Hello Francesco!
I would suggest taking a look at the ideas portal. Maybe you would also like to consider adding your feature idea, too?

Hi,

yes, good suggestion. Here the link:

Regards

Intersting that you mark your own answer as the solution, but anyways no that is not possible.
Checkmk can run multiple sites on the same server, you can have

checkmk.local/SITE1
checkmk.local/SITE2

and so on. so Checkmk needs to be able to “OWN” the re-direct to a sub path, that cant be done by anyone else.

This have been asked before and I dont see any reason for these questions, it’s just silly. run checkmk under its own sub domain instead

Hi,

  1. If you prefer/need subdomains instead of subpaths, it is ok, but I need subpaths and not subdomains
  2. As far as I know, checkmk allows to specify a single piece of subpath (default cmk), but I need more nesting (/part1/part2/part3). Is it possible to use more nesting?

Regards