Bug 1361306 - Unable to obtain user-agent or client IP in websocket handshake on OpenShift hosted WildFly
Summary: Unable to obtain user-agent or client IP in websocket handshake on OpenShift ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Routing
Version: 2.2.0
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
: ---
Assignee: Rory Thrasher
QA Contact: zhaozhanqi
URL:
Whiteboard:
Depends On: 1313395
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-07-28 18:19 UTC by Rory Thrasher
Modified: 2019-10-10 12:12 UTC (History)
10 users (show)

Fixed In Version: openshift-origin-node-proxy-1.26.3.1-1.el6op
Doc Type: Bug Fix
Doc Text:
Cause: In the websocket handshake, several headers were not being passed through the node's proxy. Consequence: Applications who depended on the information in the user-agent, X-Forwarded-For, and X-Client-IP headers were not receiving the values of those headers. Fix: The node proxy is now configured to properly send these headers in websocket connections. Result: The user-agent, X-Forwarded-For, and X-Client-IP headers have proper values set that are available to the application
Clone Of: 1313395
Environment:
Last Closed: 2016-08-24 19:47:05 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:1773 normal SHIPPED_LIVE Important: Red Hat OpenShift Enterprise 2.2.10 security, bug fix, and enhancement update 2016-08-24 23:41:18 UTC

Comment 4 Johnny Liu 2016-08-12 08:04:07 UTC
Because there is no available app to run this test, I move this bug to "ASSIGNED", once QE get such available app or only the PR merge is enough, pls move it to "ON_QA".

Comment 6 Johnny Liu 2016-08-22 02:24:41 UTC
Verify this bug with OpenShiftEnterpriseErrata/2.2/2016-08-16.1, and PASS.

Following comment 5, get the following result:
a). 
# ~/node_modules/wscat/bin/wscat --connect ws://websockettest-jialiu.ose22-auto.com.cn:8000
# tailf /var/log/openshift_gears
Aug 22 10:16:19 node2 diy[917]: app=websockettest ns=jialiu appUuid=57ba5e0282611df8f20000dc gearUuid=jialiu-websockettest-1 Incoming Request
Aug 22 10:16:19 node2 diy[917]: app=websockettest ns=jialiu appUuid=57ba5e0282611df8f20000dc gearUuid=jialiu-websockettest-1 HTTP REQUEST: GET / HTTP/1.1
Aug 22 10:16:19 node2 diy[917]: app=websockettest ns=jialiu appUuid=57ba5e0282611df8f20000dc gearUuid=jialiu-websockettest-1 Connection: Upgrade
Aug 22 10:16:19 node2 diy[917]: app=websockettest ns=jialiu appUuid=57ba5e0282611df8f20000dc gearUuid=jialiu-websockettest-1 Upgrade: websocket
Aug 22 10:16:19 node2 diy[917]: app=websockettest ns=jialiu appUuid=57ba5e0282611df8f20000dc gearUuid=jialiu-websockettest-1 Sec-WebSocket-Version: 13
Aug 22 10:16:19 node2 diy[917]: app=websockettest ns=jialiu appUuid=57ba5e0282611df8f20000dc gearUuid=jialiu-websockettest-1 Sec-WebSocket-Key: MTMtMTQ3MTgzMjE3OTYwNw==
Aug 22 10:16:19 node2 diy[917]: app=websockettest ns=jialiu appUuid=57ba5e0282611df8f20000dc gearUuid=jialiu-websockettest-1 user-agent: undefined
Aug 22 10:16:19 node2 diy[917]: app=websockettest ns=jialiu appUuid=57ba5e0282611df8f20000dc gearUuid=jialiu-websockettest-1 X-Forwarded-For: 10.72.5.41
Aug 22 10:16:19 node2 diy[917]: app=websockettest ns=jialiu appUuid=57ba5e0282611df8f20000dc gearUuid=jialiu-websockettest-1 X-Client-IP: 10.72.5.41
Aug 22 10:16:19 node2 diy[917]: app=websockettest ns=jialiu appUuid=57ba5e0282611df8f20000dc gearUuid=jialiu-websockettest-1 Host: 127.7.107.1:8080
Aug 22 10:16:19 node2 diy[917]: app=websockettest ns=jialiu appUuid=57ba5e0282611df8f20000dc gearUuid=jialiu-websockettest-1 Websocket handshake detected with key: MTMtMTQ3MTgzMjE3OTYwNw==


b). 
Create the following html test file:
$ cat test.html
  <html lang="en">
  <head>
    <title>Websocket Client</title>
  </head>
  <body>
    <script>
        console.log("I'm trying to connect!");
      var exampleSocket = new WebSocket("ws://websockettest-jialiu.ose22-auto.com.cn:8000");
      exampleSocket.onopen = function (event) {
        console.log("Connected!");
      };
    </script>
  </body>
  </html>

Access this file from local browser, get the following log from /var/log/openshift_gears
Aug 22 10:18:27 node2 diy[917]: app=websockettest ns=jialiu appUuid=57ba5e0282611df8f20000dc gearUuid=jialiu-websockettest-1 Incoming Request
Aug 22 10:18:27 node2 diy[917]: app=websockettest ns=jialiu appUuid=57ba5e0282611df8f20000dc gearUuid=jialiu-websockettest-1 HTTP REQUEST: GET / HTTP/1.1
Aug 22 10:18:27 node2 diy[917]: app=websockettest ns=jialiu appUuid=57ba5e0282611df8f20000dc gearUuid=jialiu-websockettest-1 Connection: Upgrade
Aug 22 10:18:27 node2 diy[917]: app=websockettest ns=jialiu appUuid=57ba5e0282611df8f20000dc gearUuid=jialiu-websockettest-1 Upgrade: websocket
Aug 22 10:18:27 node2 diy[917]: app=websockettest ns=jialiu appUuid=57ba5e0282611df8f20000dc gearUuid=jialiu-websockettest-1 Sec-WebSocket-Version: 13
Aug 22 10:18:27 node2 diy[917]: app=websockettest ns=jialiu appUuid=57ba5e0282611df8f20000dc gearUuid=jialiu-websockettest-1 Sec-WebSocket-Key: MTMtMTQ3MTgzMjMwNzIzNQ==
Aug 22 10:18:27 node2 diy[917]: app=websockettest ns=jialiu appUuid=57ba5e0282611df8f20000dc gearUuid=jialiu-websockettest-1 user-agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0
Aug 22 10:18:27 node2 diy[917]: app=websockettest ns=jialiu appUuid=57ba5e0282611df8f20000dc gearUuid=jialiu-websockettest-1 X-Forwarded-For: 10.72.5.41
Aug 22 10:18:27 node2 diy[917]: app=websockettest ns=jialiu appUuid=57ba5e0282611df8f20000dc gearUuid=jialiu-websockettest-1 X-Client-IP: 10.72.5.41
Aug 22 10:18:27 node2 diy[917]: app=websockettest ns=jialiu appUuid=57ba5e0282611df8f20000dc gearUuid=jialiu-websockettest-1 Origin: null
Aug 22 10:18:27 node2 diy[917]: app=websockettest ns=jialiu appUuid=57ba5e0282611df8f20000dc gearUuid=jialiu-websockettest-1 Host: 127.7.107.1:8080
Aug 22 10:18:27 node2 diy[917]: app=websockettest ns=jialiu appUuid=57ba5e0282611df8f20000dc gearUuid=jialiu-websockettest-1 Websocket handshake detected with key: MTMtMTQ3MTgzMjMwNzIzNQ==

Comment 8 errata-xmlrpc 2016-08-24 19:47:05 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2016-1773.html


Note You need to log in before you can comment on or make changes to this bug.