Websocket status 1002: "Server failed to upgrade connection"


I am attempting to upgrade my existing service to use SSL for secure connections/replications.

When I try to connect to my endpoint of format “wss://xxx.com/bucket”, I receive an error message as follows:

17:39:52.154681| [WS]: {BuiltInWebSocket#109}==> litecore::websocket::BuiltInWebSocket wss://xxx.com:443/bucket/_blipsync @0x7fd691d050d017:39:52.154715| [WS] WARNING: {BuiltInWebSocket#109} Unexpected or unclean socket disconnect! (reason=WebSocket status, code=1002)

17:39:52.154852| [Sync]: {Repl#107} Connection closed with WebSocket status 1002: "Server failed to upgrade connection" (state=1)

17:39:52.154907| [Sync] ERROR: {Repl#107} Got LiteCore error: WebSocket error 1002 "Server failed to upgrade connection"

17:39:52.154933| [Sync]: {Repl#107} now stopped

Does anyone have any idea on what could be causing this? Please let me know if I can provide any more useful information about my case. Thanks in advance.

WebSocket status 1002 is ProtocolError … this implies the HTTP response was not a valid WebSocket upgrade, or that the subsequent data wasn’t in WebSocket format. The former seems more likely — maybe the HTTP request didn’t end up at Sync Gateway or at the wrong URI. Try running curl -i wss://xxx.com:443/bucket/_blipsync and see what the response is.