An Error Occurred - Connection Lost when connecting to Qlik Sense through network appliances
Article Number: 000085738 | Last Modified: 2019/10/10
When attempting to open an application, the user is presented with a Connection Lost message:After inspecting the browser's developer's tools, they report that the socket to the Engine was closed:Upon inspecting the Proxy > Trace > System logs, we see:
Error while forwarding websocket handshake: Invalid URI: Invalid port specified. at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)↵↓ at Proxy.Core.Connection.ConnectionData.get_LogoutUri()↵↓ at Proxy.Communication.WebSocketProtocol.ProxyWebSocketFactory.ConnectWebSockets(IConnectionData connectionData, IFrontendWebSocket clientSocket, IBackendWebSocket serverSocket, IWebSocketManager webSocketManager, Action onShutdown)↵↓ at Proxy.Communication.WebSocketProtocol.ProxyWebSocketFactory.WrapAndConnectStreams(IConnectionData connectionData, Action onShutdown)↵↓ at Qlik.Sense.Communication.ExceptionExtensions.TryCatch(Action`1 onError, Action toExec, Action`1 fatalHandling)
In order to confirm that this article is pertinent, increase the verbosity of the Proxy > Audit logs (QMC > Proxies > Edit affected Proxy or Proxies > Logging > Audit Log level) to DEBUG. Inside of the debug log you will see entries like so which report the request header values which Qlik Sense Enterprise is receiving:
ProxyRequestType : Http | GET ... X-Forwarded-Host : server1.company.com, server2.company.com ...
Qlik Sense February 2019 (13.21.10)
Prior to Qlik Sense Enterprise September 2018, Qlik Sense did not detect or parse the X-Forwarded-Host header value which is commonly sent by network devices to track the lineage of requests as they are routed. A consequence of this is that the log-out button would not work when accessing Qlik Sense through a reverse proxy (see article Qlik Sense: Logout button not working when accessing through a reverse proxy). In order to fix this defect, Qlik Sense Enterprise now parses the X-Forwarded-Host header value but in order for it to know where to route the user when a logout is initiated it cannot have more than 1 value in the X-Forwarded-Host header.
Ensure that only 1 value is present for the X-Forwarded-Host header. This needs to be done upstream to Qlik Sense Enterprise and can often be done on the network devices / appliances which are in front of Qlik Sense Enterprise. If those devices do not support re-writing HTTP headers, then an additional network application may be required to re-write the request header.