Grafana behind Apache Reverse proxy

  • What Grafana version and what operating system are you using?
    Grafana 10.1.1 / Ubuntu 20.04

  • What are you trying to achieve?
    Server Grafana login through Apache reverse proxy

  • How are you trying to achieve it?

Apache setup with basic /location and then proxypass:
Listening on $IP OF NAT and proxying internal Grafana instance

    <Location /grafana>
            RewriteEngine on
            ProxyPass https://grafana-server:3000
            ProxyPassReverse https://grafana-server:3000

Following was tested with nginx and worked properly:

location /grafana {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto “https”;
proxy_pass https://grafana-server:3000;

Grafana.ini configured as follows:

protocol = https

The ip address to bind to, empty will bind to all interfaces

#http_addr =

The http port to use

http_port = 3000

The public facing domain name used to access grafana from a browser

domain = $IP of NAT

Redirect to correct domain if host header does not match domain

Prevents DNS rebinding attacks

enforce_domain = false

The full public facing url you use in browser, used for redirects and emails

If you use reverse proxy and sub path specify full url (with sub path)

#root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana/
root_url = https:/$IP OF NAT/grafana

Serve Grafana from subpath specified in root_url setting. By default it is set to false for compatibility reasons.

serve_from_sub_path = true

  • What happened?


  • What did you expect to happen?

Get login prompt

  • Can you copy/paste the configuration(s) that you are having problems with?

No, though part of this config worked awhile ago in another environment where I was reverse proxying grafana as well, however that environment wasn’t using an IP for the NAT but instead an actual DNS name

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

Can’t get to UI