You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by "Rajat Goel (Jira)" <ji...@apache.org> on 2019/09/04 13:08:00 UTC

[jira] [Updated] (KNOX-1996) For websocket connections, backend url generated is incorrect - has an extra '/' in path

     [ https://issues.apache.org/jira/browse/KNOX-1996?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rajat Goel updated KNOX-1996:
-----------------------------
    Attachment: KNOX-1996.patch
        Status: Patch Available  (was: Open)

Fixing the code as follows:
 * Adding changes to remove extra '/' when 'backed' value computed so far in StringBuffer ends with '/' and 'pathservice[1]' starts with '/'.
 * Adding changes to use 'ws or wss' as protocol in case request URI is a websocket request but service definition in Knox is defined as 'http or https'. This is needed for usecases where it is not possible to define a separate Role/Service in Knox for websocket calls. My service uses SockJS library and websocket connection are initiated internally from within the library. URI for some of the HTTP calls is same as websocket calls except for the protocol.

> For websocket connections, backend url generated is incorrect - has an extra '/' in path
> ----------------------------------------------------------------------------------------
>
>                 Key: KNOX-1996
>                 URL: https://issues.apache.org/jira/browse/KNOX-1996
>             Project: Apache Knox
>          Issue Type: Bug
>          Components: Server
>    Affects Versions: 1.3.0, 1.2.0, 1.1.0, 1.0.0
>         Environment: HDP 3.1.0
>            Reporter: Rajat Goel
>            Assignee: Rajat Goel
>            Priority: Major
>             Fix For: 1.4.0
>
>         Attachments: KNOX-1996.patch
>
>
> {quote}{color:#000000}For websocket connections, while generating backend url in _org.apache.knox.gateway.websockets.GatewayWebsocketHandler_ (_getMatchedBackendURL()_ API), Knox appends '_pathservice[1]_' to '_backend_' StringBuffer if Service url doesn't end with '/ws'. As a result, URI generated had an extra '/' eg: {color}{color:#000000}ws://{color}[rafd001-mst-01.cloud.in.guavus.com:11011//_sock/411/anq2kfzp/websocket|http://rafd001-mst-01.cloud.in.guavus.com:11011//_sock/411/anq2kfzp/websocket]{color:#000000} and my UI backend which uses SockJS lib was not responding for 2 minutes and eventually closing connection.{color}
> {color:#000000}Correct Url which should have been generated is: ws://[rafd001-mst-01.cloud.in.guavus.com:11011/_sock/411/anq2kfzp/websocket|http://rafd001-mst-01.cloud.in.guavus.com:11011//_sock/411/anq2kfzp/websocket]{color}
> {quote}



--
This message was sent by Atlassian Jira
(v8.3.2#803003)