# View Logs / exec shell - Bad handshake

**URL:** <https://forums.suse.com/t/view-logs-exec-shell-bad-handshake/3679>\
**Category:** Rancher 1.x\
**Created:** [August 11, 2016, 11:31pm UTC](https://forums.suse.com/t/view-logs-exec-shell-bad-handshake/3679 "2016-08-11T23:31:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brian\_Rosamilia](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/brian_rosamilia/32/1589_2.png) [@Brian\_Rosamilia](https://forums.suse.com/u/Brian_Rosamilia)\
**Post date:** [August 11, 2016, 11:31pm UTC](https://forums.suse.com/t/view-logs-exec-shell-bad-handshake/3679/1 "2016-08-11T23:31:34Z")

</div>

Greetings,

When trying to view logs or execute shell, I am getting a websocket handshake error.

I am aware of the fact that the clock issue and I have checked multiple times than my clocks are synchronized on every container and the host OS. (the clock issue shouldn’t be causing a 404 anyway, but a 401). I wouldn’t post here I werent completely stumped. Thanks for any help in advance

My OS:  
Ubuntu 14.04.4 LTS (4.2.0-42-generic)

Docker:  
Docker version 1.12.0, build 8eab29e

The error itself in the rancher-agent container

time=“2016-08-11T23:10:46Z” level=“info” msg=“Connecting to proxy.” url="ws://10.0.2.15:8081/v1/connectbackend?token=eyJ  
hbGciOiJSUzI1NiJ9.eyJleHAiOjE0NzA5NTczNDYsInN1YiI6ImNhdHRsZSIsImlzcyI6Imh0dHA6XC9cL2NhdHRsZS5pbyIsInJlcG9ydGVkVXVpZCI6Im  
QxNzNkMzgxLTY1ZDgtNGY0YS1hMWNmLTBjZmYxNzU1ZTdmYiIsImlhdCI6MTQ3MDk1NzA0Niwia2lkIjoiZGVmYXVsdCJ9.VhD43pgBccEDKOr7Nu9hx2nAe  
EZHgjDXOjeVkdFwA1Tdi3rKQ05UylUtMdtLe6lY-hrysjTyU7tVGUr8Hi3MymXRcgnTAfh41mF-eZhmEjuBV-WPZTWrylLoFoD-cZdB\_n4bnSZkxU1ADpTM-  
9ZD5KIjBG\_-UKbbPmE-jLnOEGta1ryduzaK42LNFXnfiqnYZX6SJVaz\_iY43wFwKMgmPSkyz0-9VPC1w5FOIZYREYqfsqPPlxmH-idiPPhNRRinuj9yxS5bH  
y0CHfcquw72TTxZKfSwvebU5hG0WVwj47dB7flYFUZGsiQu-yQ4NRYqwqxVs5Vp5xRDfWsOpzCkgw"  
time=“2016-08-11T23:10:46Z” **level=“fatal” msg=“Failed to connect to proxy.” error=“websocket: bad handshake”**

Here’s the error from the front end

WebSocket connection to ‘ws://localhost:8081/v1/logs/?token=eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE0NzA5NTY5MzAsInN1YiI6ImNhdHRsZSIsImxvZ3MiOnsiQ29udGFpbmVyIjoiZTgyNzllMWNkZWRmMDE2ZWY5Yzk0YjFmOWU0NjRlNzE4ZWRlNDc1Y2ZlMmRlNTY1NTljOTc0ZTdkOGNkM2EyNCIsIkxpbmVzIjo1MDAsIkZvbGxvdyI6dHJ1ZX0sImlzcyI6Imh0dHA6XC9cL2NhdHRsZS5pbyIsImhvc3RVdWlkIjoiZDE3M2QzODEtNjVkOC00ZjRhLWExY2YtMGNmZjE3NTVlN2ZiIiwiaWF0IjoxNDcwOTU2NjMwLCJraWQiOiJkZWZhdWx0In0.Yylz\_1s9WA34QOM2299aFStBxWuXMSwdTiji5ZNA-hxq-38pnGxbbAng-qEe938G85ZMD3Kf8sF9lsO\_liEwzmrZINeb5Q7nWyxThc2P031cCNQQUi2TycpytSPExuoV2VTjSCmjzbDVhPJYnkAIIth71mb1csOvknq\_OF5qzH74UWpxMXZsKyRHIO0p8C4IFb2LRx2U7n0vvAVeulzoPA2r2ZauGiWSQTZUL-\_B-bJGWR7Yg0Yjh1TzPhiL5onL6Hm2uVBjESJXN1VdcYMeblxUuDohj4VluV\_4R01saEWGPKIdMZB4\_TwmD3tV7Ly2MA5o5PABSrat0-gJc1063Q’ **failed: Error during WebSocket handshake: Unexpected response code: 404**

---

<div class="post-metadata">

**Author:** ![Brian\_Rosamilia](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/brian_rosamilia/32/1589_2.png) [@Brian\_Rosamilia](https://forums.suse.com/u/Brian_Rosamilia)\
**Post date:** [August 12, 2016, 12:02am UTC](https://forums.suse.com/t/view-logs-exec-shell-bad-handshake/3679/2 "2016-08-12T00:02:46Z")

</div>

Resolved after reading

> **[Writing WebSocket servers](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers)**
>
> A WebSocket server is a TCP application listening on any port of a server that follows a specific protocol, simple as that. The task of creating a custom server tends to scare people; however, it can be easy to implement a simple WebSocket server on...

I realized that using a nonstandard port (8081) might be the culprit messing up the handshake.

Sure enough changing it to 8080 fixed it. I had another service running on 8080 so I didn’t want to do this 🙂 might want to update the documentation to warn about not using 80/8080 for rancher server.

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)\
**Post date:** [August 12, 2016, 12:09am UTC](https://forums.suse.com/t/view-logs-exec-shell-bad-handshake/3679/3 "2016-08-12T00:09:37Z")

</div>

Do you have a load balancer, ssl termination, proxy, or similar in between the client and server? There’s nothing special about 8080…

---

<div class="post-metadata">

**Author:** ![Brian\_Rosamilia](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/brian_rosamilia/32/1589_2.png) [@Brian\_Rosamilia](https://forums.suse.com/u/Brian_Rosamilia)\
**Post date:** [August 12, 2016, 12:24am UTC](https://forums.suse.com/t/view-logs-exec-shell-bad-handshake/3679/4 "2016-08-12T00:24:01Z")

</div>

Well, ‘Launching Rancher Server’ recommends a port so I wasn’t sure.

This is all locally for development so nothing exotic. I’m running the Ubuntu host through vagrant (starting with the image [williamyeh/ubuntu-trusty64-docker](https://vagrantcloud.com/williamyeh/boxes/ubuntu-trusty64-docker) to be specific). Unless I’m missing something I don’t think any of those would apply.

---

<div class="post-metadata">

**Author:** ![Mr\_Koo](https://avatars.discourse-cdn.com/v4/letter/m/779978/32.png) [@Mr\_Koo](https://forums.suse.com/u/Mr_Koo)\
**Post date:** [September 5, 2016, 8:19am UTC](https://forums.suse.com/t/view-logs-exec-shell-bad-handshake/3679/5 "2016-09-05T08:19:20Z")

</div>

I had the same issue,and switch to 8080 ,the rancher server and other host worked fine.There’s something special about 8080 indeed @vincent

---

<div class="post-metadata">

**Author:** ![telangovan](https://avatars.discourse-cdn.com/v4/letter/t/3e96dc/32.png) [@telangovan](https://forums.suse.com/u/telangovan)\
**Post date:** [January 5, 2017, 12:18am UTC](https://forums.suse.com/t/view-logs-exec-shell-bad-handshake/3679/6 "2017-01-05T00:18:11Z")

</div>

same issue logs showing

msg=“Connecting to proxy.” url="ws://xx.yy.zz.aa:12345/v1/connectbackend?token=…  
**level=“fatal” msg=“Failed to connect to proxy.” error=“websocket: bad handshake”**

tried changing the port from **12345 to 8888** to see if that would help same error msg… “websocket: bad handshake”

changed from **8888 to 8080** started working fine was able to login into shell and look at logs. really something special about 8080 as stated by Mr\_Koo

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)\
**Post date:** [January 9, 2017, 5:21am UTC](https://forums.suse.com/t/view-logs-exec-shell-bad-handshake/3679/7 "2017-01-09T05:21:06Z")

</div>

There is nothing special about 8080. A significant fraction of installations change it, usually to 80/443.
