[ 
https://issues.apache.org/jira/browse/KNOX-1996?focusedWorklogId=307952&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-307952
 ]

ASF GitHub Bot logged work on KNOX-1996:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 06/Sep/19 15:23
            Start Date: 06/Sep/19 15:23
    Worklog Time Spent: 10m 
      Work Description: moresandeep commented on pull request #142: KNOX-1996: 
Adding changes to remove extra / while generating backedn …
URL: https://github.com/apache/knox/pull/142#discussion_r321778749
 
 

 ##########
 File path: 
gateway-server/src/main/java/org/apache/knox/gateway/websockets/GatewayWebsocketHandler.java
 ##########
 @@ -173,12 +174,41 @@ private synchronized String getMatchedBackendURL(final 
String path) {
 
     /* URL used to connect to websocket backend */
     String backendURL = urlFromServiceDefinition(serviceRegistryService, 
entry, path);
+    LOG.logMessage("Url obtained from services definition: " + backendURL);
 
     StringBuilder backend = new StringBuilder();
     try {
-
-      /* if we do not find websocket URL we default to HTTP */
-      if (!StringUtils.containsAny(backendURL, WEBSOCKET_PROTOCOL_STRING, 
SECURE_WEBSOCKET_PROTOCOL_STRING)) {
+      if (StringUtils.containsAny(backendURL, WEBSOCKET_PROTOCOL_STRING, 
SECURE_WEBSOCKET_PROTOCOL_STRING)) {
+        LOG.logMessage("ws or wss protocol found in service url");
+        URI serviceUri = new URI(backendURL);
+        backend.append(serviceUri);
+        /* Avoid Zeppelin Regression - as this would require ambari changes 
and break current knox websocket use case*/
+        if (!StringUtils.endsWith(backend.toString(), "/ws") && 
!StringUtils.endsWith(backend.toString(), "/websocket")
 
 Review comment:
   Why are we adding special handling for `/wesocket` path ? 
 
----------------------------------------------------------------
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: 307952)
    Time Spent: 50m  (was: 40m)

> 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.0.0, 1.1.0, 1.2.0, 1.3.0
>         Environment: HDP 3.1.0
>            Reporter: Rajat Goel
>            Assignee: Rajat Goel
>            Priority: Major
>             Fix For: 1.4.0
>
>         Attachments: KNOX-1996.patch
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> {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)

Reply via email to