Grafana behind Traefik reverse proxy with TLS

Hello all,
I have a problem getting Grafana to work behind Traefik with TLS being handled by Traefik. Grafana is configured to run on the default port 3000. Traefik is configured to redirect all connections on port 80 to 443. Connections to the grafana domain grafana.domain.lo get routed to port 3000 internally. Grafana docker-compose is configured as follows

    image: grafana/grafana:latest
    restart: unless-stopped
    container_name: grafana
      - grafana_data:/var/lib/grafana
      - "GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource,grafana-piechart-panel"
      - "GF_SERVER_ROOT_URL=https://grafana.${BASE_DOMAIN}:443"
      - "GF_SERVER_DOMAIN=grafana.${BASE_DOMAIN}"
      - backend-network
      - "traefik.enable=true"
      - ""
      - "traefik.http.routers.grafana.entrypoints=ssl"
      - "traefik.http.routers.grafana.tls=true"
      - "traefik.http.routers.grafana.rule=Host(`grafana.${BASE_DOMAIN}`)"
      - "traefik.http.routers.grafana.service=grafana-service"
      - ""

Grafana works as far as getting to the login page. From there I can’t change the password. I get

msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=POST path=/api/user/password/reset status=400 remote_addr= time_ms=13 size=52 referer=https://grafana.domain.lo/login

What am I doing wrong? Why does Grafana think that changing the password was a bad request?

p.s. It also does not save any changes I make to the default dashboard.

It took me ages to get Grafana working with Traefik (2.2.5) properly and there are still some issues. I think your problem could be this:

  • “GF_SERVER_ROOT_URL=https://grafana.${BASE_DOMAIN}:443”

I don’t think it should have the 443 as part of the URL. My config (in grafana.ini file) is:

domain = ‘domain goes here’
protocol = http
root_url = %(protocol)s://%(domain)s:/grafana/
serve_from_sub_path = true

The key is the sub path setting which tells Grafana to serve files (and save settings) behind the proxy.

I hope this may help, only just noticed your posting now.