Grafana public dashboards automatic redirect with Traefik

  • What Grafana version and what operating system are you using?
    Grafana 9.4.7 running inside a docker compose alongside traefik and InfluxDb.

  • What are you trying to achieve?
    I have a single public dashboard (beta feature) configured and would like to have an automatic redirect to that dashboard URL via traefik when someone hits my url (e.g. grafana.myserver. com should be redirected to grafana.myserver. com/public-dashboards/xxx)

  • How are you trying to achieve it?
    I have traefik configured correctly. When accessing I immediately get redirected to grafana.myserver. com/public-dashboards/xxx. Unfortunately that results in an error telling me " If you’re seeing this Grafana has failed to load its application files".
    If I access the URL directly via copying it into my browser, it works.

What can cause that problem? Technically, I think there shouldn’t be any difference.

  • Can you copy/paste the configuration(s) that you are having problems with?
    The traefik labels of my grafana service inside the docker compose file:
      - "traefik.enable=true"
      - "traefik.http.routers.grafana.rule=Host(`grafana.myserver. com`)"
      - "traefik.http.routers.grafana.entrypoints=websecure"
      - "traefik.http.routers.grafana.tls.certresolver=myresolver"
      - ""
      - "traefik.http.middlewares.redirect-to-public-dashboard.redirectregex.regex=^https:\\/\\/([^\\/]+)\\/?(.*)$$"
      - "traefik.http.middlewares.redirect-to-public-dashboard.redirectregex.replacement=https://$${1}/public-dashboards/xxx?orgId=1"
      - "traefik.http.routers.grafana.middlewares=redirect-to-public-dashboard"

      - "traefik.http.routers.grafana2.rule=Host(`grafana.myserver. com`) && PathPrefix(`/login`)"
  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.