Grafana with Apache Reverse Proxy shows 2 login pages

I read the documentation here and here but it appears that the username and / or password is not being passed from Apache to Grafana. Do you know what I am missing in my configuration?

Apache

<Proxy *>
   ### Require ip 127.0.0.1 ## For security but maybe not needed with "ProxyRequests Off"
   AuthType Basic
#   AuthName GrafanaAuthProxy
   AuthName StatsAuth
   AuthBasicProvider file
   AuthUserFile /etc/httpd/. <PASSWORD-FILENAME>
   Require valid-user

   RewriteEngine On
   RewriteRule .* - [E=PROXY_USER:%{LA-U:REMOTE_USER},NS]
   RequestHeader set X-WEBAUTH-USER "%{PROXY_USER}e"
</Proxy>

RequestHeader unset Authorization
ProxyRequests Off
SSLProxyEngine on
# ProxyPreserveHost On

<Location "/stats">
   ProxyPass https://example.com:1234
   ProxyPassReverse https://example.com:1234
</Location>

Grafana.ini

root_url = https://example.com/stats
allow_sign_up = false
allow_org_create = false
auto_assign_org_role = Viewer

[auth.proxy]
enabled = true
header_name = X-WEBAUTH-USER
header_property = username
auto_sign_up = true

Update:
I am also not able to see local snapshots without a login so I removed the proxy settings.

Thanks

Hi,

I recommend you too have a look at the authproxy documentation.

Seems like you missing some configuration to be able to use the authproxy together with reverse proxy of grafana. As described in article you linked to and my documentation link it seems like you want to remove the <Location "/stats"... and just do:

 <VirtualHost *:80>
      ...
        <Proxy *>
        ...
        </Proxy>

        RequestHeader unset Authorization

        ProxyRequests Off
        ProxyPass /stats/ https://example.com:1234/
        ProxyPassReverse /stats/ https://example.com:1234/
    </VirtualHost>

I’m no expert of apache, but would recommend to first try and get authproxy to work without advanced proxying/ssl/domains. When that is done, you can start experimenting with reverse proxy/ssl/custom domain. If you have specific authproxy problem this is the right forum, but if you have apache specific problems this may ot may not be the right forum.

Marcus