Grafana Dashboard as Lovelace iframe results in ingress issue #11273
Replies: 20 comments
-
The issue is that de frontend doesn't have a valid authenticated session via ingress for the add-on, until the normal ingress route has been visited. After that, the iframes work. This is not just a Grafana add-on issue. It applies to any add-on providing ingress. |
Beta Was this translation helpful? Give feedback.
-
@frenck Exactly that is the issue. But it would be useful to have a solution for this usecases. |
Beta Was this translation helpful? Give feedback.
-
Maybe 🤷 |
Beta Was this translation helpful? Give feedback.
-
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. |
Beta Was this translation helpful? Give feedback.
-
This is still relevant. Tested on 0.115. |
Beta Was this translation helpful? Give feedback.
-
This is not a bug, this is how iframes work. |
Beta Was this translation helpful? Give feedback.
-
Are there any known workarounds (beside opening Grafana WebUI to create ingress session)?
Any other ideas? |
Beta Was this translation helpful? Give feedback.
-
I've worked around it by having nginx in front of it redirect requests from |
Beta Was this translation helpful? Give feedback.
-
@mkarnebeek This is something I'm trying to accomplish.
|
Beta Was this translation helpful? Give feedback.
-
@ludeeus I will just quote a part of hass documentation It doesn't work. It's not a feature request. |
Beta Was this translation helpful? Give feedback.
-
It does work, from the sidebar where that feature is intended to be used. |
Beta Was this translation helpful? Give feedback.
-
@ludeeus Why would anyone want to generate dashboard elements that you can't use and share? That is the reason graphana exists. |
Beta Was this translation helpful? Give feedback.
-
For OPs first possible solution: Other possibility (but I think a feature of |
Beta Was this translation helpful? Give feedback.
-
I am also interested in a solution |
Beta Was this translation helpful? Give feedback.
-
As an interim bandaid solution I have done the following: I made a new “web card” on my main home assistant landing page with the link copied from the grafana link in the side panel... "https://xxxxxxxx.duckdns.org:8123/a0d7b954_grafana". Set the Aspect Ratio to 0% and leave the title blank and the card will effectively be hidden (may be better ways to do this?) It's not perfect but now when I open home assistant in a new browser or on a new device the hidden web card authorises to grafana and then my grafana cards display fine. (So I don't have to first click on the grafana link in the side panel) Note all my grafana chart cards are on a different view/tab in home assistant to my main landing page so the hidden authorisation webcard connects before I change to the views with grafana charts. Haven't tried if it works when they are on the same view/tab in home assistant. |
Beta Was this translation helpful? Give feedback.
-
For me this workaround is not working on iOS :( Anyone else tested the suggested workaround? |
Beta Was this translation helpful? Give feedback.
-
Im having this very problem. I just updated Grafana and I think that made it worse, not sure what to do here. Tried adding the configuration bits that others have suggested on other forumns, tried resetting the cache, tried port 300 and port 8123, nothing works. How do we solve this? I just want to view my graphs inside Home Assistant on my phone. |
Beta Was this translation helpful? Give feedback.
-
@dermotduffy once suggested me that it should be proxied by a Home Assistant integration before the Lovelace card can access it. dermotduffy/frigate-hass-card#331 (comment) This is how Frigate card ends up communicating with the Frigate addon (through the Integration which proxies the necessary endpoints). |
Beta Was this translation helpful? Give feedback.
-
I get 401: Unauthorized on grafana in iFrame card. |
Beta Was this translation helpful? Give feedback.
-
For the record i encountered the same problem by trying to use an hassio Zigbee2Mqtt ingress URL (like (See home-assistant/core#96100 ad home-assistant/core#96107) NB: in the above, the Possible solutions to cover the two usecases (being iframes and "Visit" button): I think B is simpler Is there a more general discussion for this ingress session problem ? Any other ideas ? |
Beta Was this translation helpful? Give feedback.
-
The problem
Use of Grafana Dashboards in Lovelace iframe isn't possible if Grafana is access is using ingress as sometimes there is no valid session on the ingress controller.
Environment
https://www.home-assistant.io/lovelace/iframe/
https://github.com/hassio-addons/addon-grafana
Problem-relevant from
lovelace
cardTraceback/Error logs
Additional information
There were multiple people wishing a real solution for this issue. I think it is complex and needs to be discussed generally how to solve this issue.
As already stated here (https://community.home-assistant.io/t/401-unauthorized-iframe-card-of-grafana-not-working-on-the-www-local-network-ok/148017/21), the issue can't be resolved by grafana addon, as if the error occours there is no traffic that reaches the grafana docker container.
So the problem has to be resolved before (ingress/lovelace webpage card?)
There are a workaround out there but with real downsides.
The workaround is to enable a port for ingress in the grafana addon and allow anonymous login.
The downside in this solution is:
a) remote access to grafana dashboard needs additional port (e.g. additional port-forwarding on router)
b) anonymous login needs a role in grafana. If role is
viewer
I'm also just a viewer if I access the grafana over the link in the left. So I can't edit anything. If role iseditor
oradmin
everyone with access to configured port can edit everything.So for my usecase this is really not desired. I want to shared just some dashboards but no one exept the HA admin should edit any of the dashboards. For this case there is no solution.
May be possible solutions:
May there will be other possibilities I don't know at the moment.
Beta Was this translation helpful? Give feedback.
All reactions