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
WebSocket connection failed. Error in browser console, since Grafana version 8.0.4. #36929
Comments
Digging around I can't find a fix. I no longer understand how one is supposed to configure grafana to use an https-offloading reverse proxy |
This is caused by a change made in v8.0.4 to solve #34537 By default, Grafana now checks request Origin of WebSocket Upgrade request to match There is also a known bug #36822 – I am not sure whether it's related to your specific setup though. I need a server warning line to understand, could you guys post warning from server logs which contains But while this bug exists it's still possible to use |
Thank you! Is fixed now and working fine! |
I receiving also this msg with Grafana 8.1.1, but in my case I have
In Chrome console is error visible as:
I have this in my
Can you tell me why this error occuring or can I ignore it? 🤔 |
@Rohlik hello, 400 in most cases caused by reverse proxy. Are you using Nginx? In this case you need to enable WebSocket proxy support (since Nginx can't proxy WebSocket by default) as shown here. |
@FZambia Thank you for that. Yes, we are using Apache as reverse proxy. Now, because of you I know what I need to fix. Thanks once more time 👍🏽 . Solution for Apache2 - use this in your virtualhost configuration:
|
Hi, I'm getting the Grafana version: OSS 8.2.2 installed through apt on Ubuntu server I'm using nginx as reverse proxy with letsencrypt. grafana log file:
note: the path=//ws looks weird; maybe it's normal ? nginx map added in
nginx virtualhost:
Grafana config:
what could be wrong? |
@gioy hello, |
I had the same issue, this is what finally worked for me: location /grafana/ {
proxy_pass http://localhost:3000/;
}
location /grafana/api/live/ws {
rewrite ^/grafana/(.*) /$1 break;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $http_host;
proxy_pass http://localhost:3000/;
} |
@Niek thank you, it worked; the extended location with the rewrite made the trick. Since I'm using a subdomain url instead of a subpath (like you do) here's my working nginx configuration:
|
This fixes issues: grafana/grafana#36929 grafana/grafana#35988
@gioy could you try your original configuration but without trailing slash in the
On subpath |
I'm also using Apache, but @Rohlik 's solution above didn't work for me, possibly because we have Grafana in sub path and using SSL. This worked, however: <Location /grafana>
# destination directory
ProxyPreserveHost On
ProxyPass http://127.0.0.1:3000
ProxyPassReverse http://127.0.0.1:3000
RequestHeader set X-Forwarded-Proto 'https'
Header set X-Frame-Options SAMEORIGIN
Order deny,allow
Allow From all
</Location>
<Location /grafana/api/live/ws>
#Deal with websocket for live updates
ProxyPreserveHost On
ProxyPass ws://127.0.0.1:3000/grafana/api/live/ws
ProxyPassReverse ws://127.0.0.1:3000/grafana/api/live/ws
</Location> I also enabled serve_from_sub_path = true in |
WebSocketClient.js:16 WebSocket connection to 'wss://3000-nazar2343-testproject-94kvcv2mnk8.ws-eu38.gitpod.io:3000/ws' failed: Як вирішити проблему поможіть пліз |
Same issue for Grafana 8.4.4 centrifuge.js:585 WebSocket connection to 'wss://xxxx-proxy-grafana.xxxxx.com/api/live/ws' failed: centrifuge.js:585 |
@nazar2343 @SincerelyUnique hello, WebSocket error usually happens due to 2 possible reasons:
|
Hi. I know this is closed, I have trying to establish connection to wss using apache httpd on Oracle Linux 8 and i keep getting the wss failed warning when I inspect and my application is running using wildfly and it is accessible securely using https but I am unable to access web socket securely with https. |
If you are using nginx proxy to serve grafana then you can use below configuration to solve web socket issue. http {
} |
I am posting my solution for a Kubernetes deployed Grafana where I got 400 for the socket connections. I have HAProxy terminate SSL before the request gets into the Kubernetes NGINX Inc ingress controller. I added this annotation to my ingress:
loki-grafana.monitoring.svc.cluster.local is the internal DNS for the service. Now I get 101. |
I got same errors. |
Starting from version 8.0.4, a lot of this messages: WebSocket connection to 'ws://ip_host:port/api/live/ws' failed: centrifuge.js:544 , started to show in the Chrome console.
And Firefox console
No change was done to the existing dashboards, all was working great before. The messages just start appearing after upgrading from 8.0.3.
Environment:
The text was updated successfully, but these errors were encountered: