0
Hello people I am using the iframes of the graphana in my HTML page running in Django/python, however every time I open my page to view the embed Graficos I need to access the graphana and so perform the login to authenticate my user, my application Django already has a login page, I would like to use just one login on my page and send a proxy request to grafana, so I do not need to perform two logins every time I open my application.
I tried to use it this way:
View
class GraphanaProxyView(ProxyView):
    upstream = 'http://172.30.3.141:3000/'
    def get_proxy_request_headers(self, request):
        headers = super(GraphanaProxyView, self).get_proxy_request_headers(request)
        headers['X-WEBAUTH-USER'] = request.user.username
        return headers
Urls
url(r'^grafana/(?P<path>.*)$', views.GraphanaProxyView.as_view(), name='graphana-dashboards'),
Config Grafana
grafana:
    image: grafana/grafana:latest
    container_name: grafana
    restart: always
    ports:
      - "3000:3000"
    volumes:
      - "./grafana/datastore:/var/lib/grafana"
    environment:
      - GF_SMTP_ENABLED=true  
      - GF_SMTP_HOST=smtp.gmail.com:587
      - [email protected]
      - GF_SMTP_PASSWORD=password
      - GF_SMTP_FROM_NAME=Grafana Snipped
      - GF_SMTP_SKIP_VERIFY=true
      - GF_AUTH_ANONYMOUS_ENABLED=true
      - GF_AUTH_ANONYMOUS_ORG_NAME=View
      - GF_AUTH_ANONYMOUS_ORG_ROLE=View
      - GF_USERS_ALLOW_SIGN_UP=false
      - GF_AUTH_PROXY_ENABLED=true
      - GF_AUTH_PROXY_HEADER_NAME = X-WEBAUTH-USER
      - GF_AUTH_PROXY_HEADER_PROPERTY=username       
      - GF_AUTH_PROXY_AUTO_SIGN_UP=true 
      - GF_AUTH_PROXY_LDAP_SYNC_TTL=60
      - GF_AUTH_PROXY_WHITELIST = 172.30.3.207
      - GF_SERVER_DOMAIN = 172.30.3.141
I’m getting this error when accessing URL:
If you’re Seeing this Grafana has failed to load its application files
- This could be caused by your Reverse proxy Settings. 
- If you host grafana under subpath make sure your grafana.ini root_path Setting includes subpath 
- If you have a local dev build make sure you build frontend using: npm run dev, npm run watch, or npm run build 
- Sometimes restarting graphana-server can help 
Fero, translate your answer to English!
– Luiz Augusto
Luca, Answering your Question, the request.user.username I Believe is not the same Registered in grafana. I have one a Question, Every time I Register a new user in my application, the same user needs to be Registered in grafana or this is generated Automatically? my iframe src is "<iframe src =" http://172.30. 3.141:3000/d-solo/cFb9_r9mz/senseops-Dashboard? refresh=5s&orgId=1&panelId=71&Theme=light "width =" 100% "height = "200" frameborder = "0"> "
– Gabriel Santos
You are right. Try the Curl and Let me know
– fero