Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-57186

New View href is an absolute URL but other menu items are relative URLs

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: core
    • Labels:
    • Environment:
      Jenkins 2.164.2
    • Similar Issues:

      Description

      The href of the "New View" link in the left panel is constructed differently from the other links and is an absolute URL rather than a relative URL.

       

      I've only noticed this issue because our Jenkins server is setup inside a VPN.  So we VPN into the university and then SSH to our gateway machine.  Thus we use two domain name variants to access Jenkins depending on whether the user is in the lab (thus using "jenkins.int") or outside the lab (thus using "jenkins.vpn").

      The consequence of this is that when an external user accesses the Jenkins server via VPN/SSH using "jenkins.vpn", the "New View" link points to "jenkins.int/newView" instead of "jenkins.vpn/newView".  This means that external users get a 404 error (Server not found) and need to manually correct the url.  (Minor/trivial bug.)

       

      In core/src/main/java/jenkins/model/NewViewLink.java, starting line 45

       

      @Override
      public String getUrlName() {
          String urlName = Jenkins.getInstance().getRootUrl() + URL_NAME;
          return urlName;
      }
      

      the class prepends Jenkins.getInstance().getRootUrl() to URL_NAME.  If "/" is prepended instead, urlName becomes a relative address, and the "New View" link is fixed.

      As I am not familiar with the Jenkins codebase, I'm not sure if this is the right way to fix this problem.

       

       

        Attachments

          Issue Links

            Activity

            Hide
            nisarg14 Nisarg Shah added a comment -

            Napoleon BlownApart I think that the solution you proposed would work.

            Because making URL Relative would be a solution.

            Oleg Nenashev What is your view?

            Show
            nisarg14 Nisarg Shah added a comment - Napoleon BlownApart I think that the solution you proposed would work. Because making URL Relative would be a solution. Oleg Nenashev What is your view?
            Hide
            markewaite Mark Waite added a comment -

            The use of an absolute URL seems to also block a menu click from creating a new view on a folder. Steps I took included:

            1. Create a new folder and navigate into the folder
            2. Click the "New view" link on the left side of the page, confirm that it opens "/newView" instead of opening "/folder/newView"

            I've created views on folders before, but the same behavior is seen on Jenkins 2.235.5 and on Jenkins 2.249.1. I did not research any further into the past to determine when that behavior changed.

            The workaround is to append "/newView" to the end of the folder URL. Views will then be created in the folder.

            Show
            markewaite Mark Waite added a comment - The use of an absolute URL seems to also block a menu click from creating a new view on a folder. Steps I took included: Create a new folder and navigate into the folder Click the "New view" link on the left side of the page, confirm that it opens "/newView" instead of opening "/folder/newView" I've created views on folders before, but the same behavior is seen on Jenkins 2.235.5 and on Jenkins 2.249.1. I did not research any further into the past to determine when that behavior changed. The workaround is to append "/newView" to the end of the folder URL. Views will then be created in the folder.

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              nap Napoleon BlownApart
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated: