-
Notifications
You must be signed in to change notification settings - Fork 660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Live Log Issues Through Reverse Proxies #5509
Comments
I have the same problem since 2024.12.0, and most likely related to live log. And very often I don't see the hidden menu (the 3 vertical dots) when in system->logs. When using companion, the logs are displayed, but the 3 dots (the menu to Show HAOS startups) are not. Strangely, when in a browser while getting the dreadful "Loading full log..." the menu "Show HAOS startups" (the 3 dots) is accessible. More info:
|
The log requests are long running HTTP requests, but typically proxies should handle them transparently. We do use a somewhat special request header FWIW, on my test setup with the NGINX Home Assistant SSL proxy add-on (which acts as a reverse proxy too), the new logs are displayed correctly and actively followed just fine. |
I'm just as stumped with this. What is really strange is that if I try to access the logs for Frigate it hangs, but then if I launch the Frigate UI and then go back to access/load the logs for Frigate it comes up. None of the other addons do that. I guess I'll just need to live with only being able to access the logs when I'm local. |
I'm not sure if it fits thematically or is a separate issue, but the live logs also don't work via Cloudflare DNS Proxy (specifically Cloudflare Tunnel, which acts as reverse proxy as well). |
Same here, but it also (inconsistently) doesn't work with the internal Most of the time when it doesn't work it's when I hit the reload button; it will say "Failed to get someaddon logs, Load failed". Sometimes it did load the logs, just didn't continue to update; sometimes doesn't update at all. |
Same problem for me: https://community.home-assistant.io/t/live-logs-and-reverse-proxy/801448 between local and outside url: it’s look like that the follow function using this URL: WEBSITEFQN/api/hassio/addons/a0d7b954_grafana/logs/follow?lines=100 any clue? |
Log doesn't work when using the addon ZeroTier by Franck Nijhof. @agners to reproduce the problem, one could start with that in a very simple setup perhaps. |
I had previously posted my issue here My setup is pretty straight forward. Cloudflare hosts my FQDN, NPM running internally to point to HA. If I access the logs via the internal IP, they work. So for fun I logged into cloudflare, and changed the proxy status from proxied, to DNS only. So my hunch here is that this has something to do with Cloudflare and not necessarily the fact that it's through a reverse proxy. |
Alright, so, I figured out the cause when it's a nginx reverse proxy: Buffering. But importantly, setting You need I'm not sure that HA can do much about it except for documenting it, and explicitly calling it out as a possibility when getting the log fails in a manner consistent with proxy buffering screwing things up. Well, barring solutions that replace the live log streaming with some other method of transit aside from an unending chunked stream. For those of you following from home, the very short version of the problem is that nginx is trying to read the entire response before it sends the response off to the client, and this works fine the vast majority of the time. Except live logs are sent in chunks, with more chunks coming over time as more log lines come in. There will never be an 'end' to those chunks, and so the response never finishes... And at best nginx sends some of the data after a significant delay. I strongly suspect that Cloudflare's proxy is doing exactly the same thing, expecting the response to come to an end, and not bothering to send chunks to the client until it does. Reading through the nginx reverse proxy code, it definitely attempts to handle this case correctly, so this feels to be, at least in part, like an nginx bug. But I'd have to spend a lot more time debugging to figure out what's going on with nginx. |
Nice find! I wonder why my tests with the add-on didn't show the problem 🤔. I'll have to retest again and check the options set in the add-on. It does seem there is the |
Please consider changing the Content-Type for these live-log responses to fix cloudflare proxies - see discussion at: cloudflare/cloudflared#199. The combination of the response headers recommended at https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#sending_events_from_the_server might do the trick:
The first should fix NGINX per the discussion above. |
But this are not SSEs, that would be the wrong MIME type for this content... |
I assumed it was probably something like this! Great find. |
So in an attempt trying to reproduce this here, I looked into the configuration of the NGINX add-on again. Live logs indeed seem to work fine, but I then noticed that buffering is disabled by default: However, even after removing that setting in a local test (and explicitly set it to It seems there is some other component contributing to this. Maybe some of the other configuration options influence the behavior? |
Ok, I found the culprit why I wasn't able to reproduce: The NGINX add-on config also sets So, without http2, and no |
Describe the issue you are experiencing
I'm using a reverse proxy to access HA (SWAG). I use the basic config for nginx that they provide and have made no edits over the past year. After an update approximately 2 months ago (I think having to do with Live logs) I can only see live logs when I'm using my server IP or internal network URL. When I try to access the "live" logs for anything HA related (including Addons) I only see "Loading full log..."
One note: I can download the logs if I use the download icon, and I also have access to them if I install the Portainer add-on and review them from Portainer.
An additional note this happens in multiple browsers and on my multiple devices and the issue occurs when accessing logs through the HA Android App as well.
What type of installation are you running?
Home Assistant OS
Which operating system are you running on?
Home Assistant Operating System
Steps to reproduce the issue
If I access HA though a direct IP or internal network URL the live logs are accessible.
...
Anything in the Supervisor logs that might be useful for us?
System Health information
System Information
Home Assistant Community Store
Home Assistant Cloud
Home Assistant Supervisor
Dashboards
Recorder
Sonoff
Spotify
SpotifyPlus
Supervisor diagnostics
config_entry-hassio-01JDDQTE6MBNXC3KSBH487VZ35.json
Additional information
No response
The text was updated successfully, but these errors were encountered: