How to resolve the error: “Could not open websocket connection: websocket: could not find connection header with token ‘upgrade'”

You may see following error message in xray_server.log; although it does not affect the backend:

[2017/04/28 12:19:56 UTC] [EROR] (jfrog.com/xray/handlers/ws.WsHandler.ConnectWsServer:29) Could not open websocket connection: websocket: could not find connection header with token 'upgrade'

As a result, you may see following issues in the Xray GUI

  • JFrog Xray database download progress bar does not get updated (e.g. the progress bar stays in 1% even though it finishes in the backend)

  • log messages fail to show

The issue is seen when WebSocket requests are not passed correctly by a reverse proxy or a load balancer. Below is an instruction on resolving the issue.

For Nginx:

Add following settings in the nginx:

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade

For AWS ELB (Elastic Load Balancer) - Classic
AWS ELB's HTTP protocol does not pass web socket request. As a work-around, you may use TCP protocol on the ELB.
As an alternative, you may use Amazon's Application Load Balancer that supports WebSocket