hassio-addons / addon-grafana

Grafana - Home Assistant Community Add-ons
https://addons.community
MIT License
221 stars 61 forks source link

Help - Grafana reverse proxy not working #244

Closed jmbinette closed 2 years ago

jmbinette commented 2 years ago

Help, I've read numerous posts, forum and official doc and cannot get the addon to behave like the Grafana documentation

Problem/Motivation

I want to be able to share Dashboard and iPanels within my LAN and from outside.

Expected behavior

If I browse to mydomain.net/grafana or 192.168.1.1:3000, should be redirected to Grafana

Actual behavior

For some reason, I always get "If you're seeing this Grafana has failed to load its application files" when trying to reverse proxy Grafana.

Steps to reproduce

I have the add-on installed in HomeAssistant.

Add-on version: 7.4.0 You are running the latest version of this add-on. System: Home Assistant OS 7.1 (amd64 / qemux86-64) Home Assistant Core: 2021.12.10 Home Assistant Supervisor: 2021.12.2 When I browse to : mydomain.net/grafana , I get redirected to mydomain.net/api/hassio_ingress/ with the message "If you're seeing this Grafana has failed to load its application files"

Same behavior if I browse 192.168.1.1:3000

Grafana configuration :

certfile: fullchain.pem
env_vars:
  - name: GF_SERVER_DOMAIN
    value: mydomain.net
  - name: GF_SERVER_ROOT_URL
    value: '%(protocol)s://%(domain)s:%(http_port)s/grafana/'
  - name: GF_SERVER_SERVE_FROM_SUB_PATH
    value: 'true'
  - name: GF_AUTH_ANONYMOUS_ENABLED
    value: 'true'
  - name: GF_SECURITY_ALLOW_EMBEDDING
    value: 'true'
  - name: GF_SECURITY_COOKIE_SAMESITE
    value: none
  - name: GF_SECURITY_COOKIE_SECURE
    value: 'true'
  - name: GF_SECURITY_LOGIN_REMEMBER_DAYS
    value: '365'
  - name: GF_AUTH_BASIC_ENABLED
    value: 'true'
  - name: GF_LOG_MODE
    value: console file
keyfile: privkey.pem
plugins: []
ssl: false

And my NGINX config :

    location /grafana/ {
        proxy_pass http://192.168.1.1:3000/; #Grafana
        proxy_set_header Host $host;
    }
    # Proxy Grafana Live WebSocket connections.
    location /grafana/api/live {
            rewrite  ^/grafana/(.*)  /$1 break;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;
            proxy_set_header Host $host;
            proxy_pass http://192.168.1.1:3000/;
            }