Apache - Auth proxy with referer

Hi, I am trying to integrate Grafana dashboard in another web application. I would like to bypass Grafana authentication using Auth Proxy, but, as far as I understood from Grafana docs, user has to insert username and password in Apache basic authentication to log in into Grafana. I would like not to use Apache Basic authentication, but Referer, so only users coming from my web application can log in into Grafana, without inserting username and password. I tried to set up a configuration but Grafana web interface does not load: I see in debugging console that javascript calls are blocked with HTTP error 401 (Unauthorized). Here is my Apache configuration so far:

SetEnvIf Referer "98.xx.xx.1" localreferer
<Proxy "*">
    Require env localreferer
    RequestHeader set X-WEBAUTH-USER "reader"
RequestHeader unset Authorization
ProxyRequests Off
ProxyPass / http://grafana:3000/
ProxyPassReverse / http://grafana:3000/

And here is grafana.ini:

allow_sign_up = false
auto_assign_org = true
auto_assign_org_role = Editor

enabled = true
header_name = X-WEBAUTH-USER
header_property = username
auto_sign_up = true

Do you have any clue?