[
https://issues.apache.org/jira/browse/KNOX-1361?focusedWorklogId=515571&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-515571
]
ASF GitHub Bot logged work on KNOX-1361:
----------------------------------------
Author: ASF GitHub Bot
Created on: 23/Nov/20 14:51
Start Date: 23/Nov/20 14:51
Worklog Time Spent: 10m
Work Description: moresandeep opened a new pull request #386:
URL: https://github.com/apache/knox/pull/386
## What changes were proposed in this pull request?
Fix an issue with rewriting websockets for socket.io backend
## How was this patch tested?
Patch was tested locally
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 515571)
Remaining Estimate: 0h
Time Spent: 10m
> Path rewrites for websockets not being handled correctly
> --------------------------------------------------------
>
> Key: KNOX-1361
> URL: https://issues.apache.org/jira/browse/KNOX-1361
> Project: Apache Knox
> Issue Type: Bug
> Affects Versions: 1.0.0
> Reporter: trsmith2
> Assignee: Sandeep More
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
> We're using the JS library socket.io to dynamically update an AngularJS app
> which we're using Knox to proxy. The socket.io library supports a number of
> protocols, upgrading to websockets if possible.
> What we're seeing is that the websocket connection fails to be established
> all the way through to the backend, apparently because the URL that socket.io
> happens to use, which consists of a number of path segments and query
> components, is truncated back to the base backend URL only.
> Analysis of the code suggests -
>
> a) The existing unit test (WebsocketEchoTest) is hard-coded to test a
> backend URL that ends in /ws. This corresponds to a special case in the code
> for Zeppelin, so the other paths are never tested, and hence the unit test
> always passes.
> b) createWebSocket passes only a path, so the query component could never be
> considered by getMatchedBackendURL
> c) getMatchedBackendURL doesn't seem to base its logic on the rewrite rules
> at all, in the case where the backend URL doesn't end in /ws it appends the
> remainder of the path to the backend (you can demonstrate this by altering
> the test case to remove the /ws from the backend URL and running the existing
> test - the rewrite rule is \{**}/channels but the result is simply /channels).
> d) Due to (a) this is a moot point, but the unit test doesn't check that the
> path was rewritten as expected, so it will pass regardless.
>
> The current thinking is that if we address (b) to pass a concatenation of
> the path and query then it might work for cases like ours. We also need to
> address (c) which will affect anyone wanting to control rewrites, and
> addressing (a) and (d) would help in the longer term.
>
> I've raised all of this together for now, we can split it out into multiple
> items if you'd prefer.
> See thread at
> [https://mail-archives.apache.org/mod_mbox/knox-user/201806.mbox/%3CCAGB2t9ganh6eiNkzckSGbvU9GJKUHxpAPakivpGzmKzrFdWvUg%40mail.gmail.com%3E]
> for the rest of the discussion on this.
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)