Uploaded image for project: 'ONOS'
  1. ONOS
  2. ONOS-8110

The gui2 view data (onos 2.4.0) is not being loaded on landing screen (landing page post login i.e. topo2 route) when https is enabled.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 1.15.0, 2.0.0, 2.1.0, 2.2.0, 2.3.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Environment:

      Enabled https by providing server side certificate signed by CA. 

      Testing locally in developer system - Ubuntu 20.04.

      Browser used - Mozilla Firefox 78.01

    • Story Points:
      1

      Description

      The url being opened on browser is as follows:- https://<ip>:8443/onos/ui/index.html 

      User arrives at the login page and enters onos/rocks as username/password. The landing page (topo2 route) has missing view content.

      Possible cause as per findings:-

      1) Seems like the protocol being used for websocket in case of https is still ws. I think instead it should have been wss. I came to this conclusion after seeing the browser logs where there is an operation insecure error while creation of web socket. 

       2) On further debugging of the browser code, I stepped into the matchSecure method of Angular UrlFnService. This method checks for window.location.protocol. If it is https, then append s to the current protocol (in our case,ws),else return it as it is. But window.location.protocol doesn't just return https. The returned value is actually https:. And so I am thinking due to strict equality check (===) being used to compare https: and https, the result will always be ws and not wss since the condition always fails.

       3) I also saw the source code for gui2-fw-lib from master branch and for previous versions till 1.15. There the same logic exists.

      4) But I suppose this was working in onos 1.14 and earlier. So i checked the code for gui where they were using $location service. Now $location.protocol() returns http or https only without colon and so the comparison always succeeded.

       

      I have attached the screenshots for the error in onos-2.4.0 (my developer system) plus also the source code for gui2-fw-lib and gui.

       

      Two Proposed solutions:-

      In urlfn.service.ts file, update the logic inside matchSecure as follows:-

      1) const secure : boolean = (p.includes("https")||p.includes("wss"))

         Note - I am assuming that there is a polyfill included in gui2-fw-lib which takes care of includes compatibility for IE.

      2) const secure : boolean = (p==="https:" || p==="wss:")

      I am more in favour of 1st method.

      Also if the possible cause and fix are rightly suggested by me, I would like to contribute to the official code if given opportunity.

        Attachments

        1. ONOS_2.4.0_landing_page_browser_console_error.png
          766 kB
          Lakshya Thakur
        2. ONOS_2.4.0_landing_page_error_cause.png
          794 kB
          Lakshya Thakur
        3. ONOS_GUI_source_code_urlfn.png
          433 kB
          Lakshya Thakur
        4. ONOS_GUI2_soruce_code_urlfn.png
          480 kB
          Lakshya Thakur
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            lapstjup Lakshya Thakur
            Reporter:
            lapstjup Lakshya Thakur
            Approvers:
            Ray Milkey, Sean Condon
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: