Bug 1313395
Summary: | Unable to obtain user-agent or client IP in websocket handshake on OpenShift hosted WildFly | |||
---|---|---|---|---|
Product: | OpenShift Online | Reporter: | Jaspreet Kaur <jkaur> | |
Component: | Routing | Assignee: | Rory Thrasher <rthrashe> | |
Status: | CLOSED WONTFIX | QA Contact: | zhaozhanqi <zzhao> | |
Severity: | low | Docs Contact: | ||
Priority: | low | |||
Version: | 2.x | CC: | aos-bugs, erich, jgoulding, jkaur, jokerman, mirano.tuk, mmccomas, tiwillia | |
Target Milestone: | --- | |||
Target Release: | --- | |||
Hardware: | Unspecified | |||
OS: | Unspecified | |||
Whiteboard: | ||||
Fixed In Version: | Doc Type: | Bug Fix | ||
Doc Text: | Story Points: | --- | ||
Clone Of: | ||||
: | 1361306 (view as bug list) | Environment: | ||
Last Closed: | 2017-05-31 18:22:11 UTC | Type: | Bug | |
Regression: | --- | Mount Type: | --- | |
Documentation: | --- | CRM: | ||
Verified Versions: | Category: | --- | ||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
Cloudforms Team: | --- | Target Upstream Version: | ||
Embargoed: | ||||
Bug Depends On: | ||||
Bug Blocks: | 1361306 |
Description
Jaspreet Kaur
2016-03-01 14:24:35 UTC
I have confirmed that the websocket upgrade headers are set here: https://github.com/openshift/origin-server/blob/master/node-proxy/lib/proxy/ProxyServer.js#L458-L469 As you can see, the upgrade request headers are not inherited, which is why user-agent is not showing up, and the X-Forwarded-For and X-Client-IP headers are not being set. We probably want something like: var zheaders = { 'headers': {}}; zheaders.headers['user-agent'] = upgrade_req.headers['user-agent']; /* Set X-Forwarded-For HTTP extension header. */ var xff = upgrade_req.connection.remoteAddress || upgrade_req.socket.remoteAddress; zheaders.headers['X-Forwarded-For'] = xff; /* Set X-Client-IP HTTP extension header. */ zheaders.headers['X-Client-IP'] = xff; /* Pass down the cookie, if any */ ... Commit pushed to master at https://github.com/openshift/origin-server https://github.com/openshift/origin-server/commit/bc5f3cc93a9df3c165b0c6490819c30bfbff585e Bug 1313395 - Forward several headers in websocket upgrade requests *** Bug 1369533 has been marked as a duplicate of this bug. *** QA, the same instructions for the enterprise version can be used to test this. Please follow the below steps to test the fix for this bug: 1) Create a diy application using the application code found at https://github.com/tiwillia/SimpleDIYPrintHeaders.git $ rhc app-create websockettest diy --from-code https://github.com/tiwillia/SimpleDIYPrintHeaders.git [...] URL: http://websockettest1-tiwillia.dev.rhcloud.com/ [...] 2) Create a websocket connection to the application on port 8000. You can do this any way you'd like, but I found this to be the easiest: 4a) Install and use the wscat tool: $ npm install wscat $ ~/node_modules/wscat/bin/wscat --connect ws://websockettest1-tiwillia.dev.rhcloud.com OR 4b) Copy the following into a file on your local machine and open the file in your browser of choice: <!doctype html> <html lang="en"> <head> <title>Websocket Client</title> </head> <body> <script> console.log("I'm trying to connect!"); var exampleSocket = new WebSocket("ws://websockettest1-tiwillia.dev.rhcloud.com:8000"); exampleSocket.onopen = function (event) { console.log("Connected!"); }; </script> </body> </html> 3) `rhc tail` the logs of the app as the connection is made or view the logs afterwards. The headers the application receives during the inital connection will be printed to the application logs. Verify that the user-agent, X-Forwarded-For, and X-Client-IP headers are recorded in the logs. Please let us know if there are any questions. QE tried to verify this bug on devenv_5831. but met issue in step: # rhc app show websockettest websockettest @ http://websockettest-dma.dev.rhcloud.com/ (uuid: 58462e52ee4a68062f000017) ------------------------------------------------------------------------------------------ Domain: dma Created: Dec 05 10:19 PM Gears: 1 (defaults to small) Git URL: ssh://58462e52ee4a68062f000017.rhcloud.com/~/git/websockettest.git/ Initial Git URL: https://github.com/tiwillia/SimpleDIYPrintHeaders.git SSH: 58462e52ee4a68062f000017.rhcloud.com Deployment: auto (on git push) diy-0.1 (Do-It-Yourself 0.1) ---------------------------- Gears: 1 small # ~/node_modules/wscat/bin/wscat --connect ws://websockettest-dma.dev.rhcloud.com/ error: Error: unexpected server response (502) Could you help on this? thanks. We apologize, however, we do not plan to address this report at this time. The majority of our active development is for the v3 version of OpenShift. If you would like for Red Hat to reconsider this decision, please reach out to your support representative. We are very sorry for any inconvenience this may cause. The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days |