Jenkins searchbox result URLs incorrect

Viewed 289

We have a problem with the URLs returned by the Jenkins search functionality.

Our Jenkins URL is, say, https://example.com/jenkins

Jenkins sits behind a reverse proxy (HAProxy). We've configured HAProxy as follows:

frontend buildserver
        bind *:443 ssl crt /etc/ssl/certs/example.com.pem
        http-request set-header X-Forwarded-Proto https
        http-request set-header X-Forwarded-Host example.com
        http-request set-header X-Forwarded-Port 443
        acl PATH_JENKINS path_beg -i /jenkins
        use_backend jenkins-http if PATH_JENKINS

backend jenkins-http
        server jenkins 127.0.0.1:8080

and in /etc/default/jenkins we have:

JENKINS_ARGS="--webroot=/var/cache/$NAME/war --httpPort=$HTTP_PORT --prefix=/jenkins"

In the GUI configuration we have Jenkins URL set to:

https://example.com/jenkins/

Everything appears to work and I can navigate all links in Jenkins with the exception of any search results generated using the search box on the top panel. These search results link to the job/view/etc URL without the "/jenkins/" prefix and therefore don't work.

We have recently upgraded Jenkins and I'm told the search results previously worked.

Has anybody else seen this issue?

Ubuntu, Jenkins 2.289.2

UPDATE: I downgraded to our previous version 2.263.4 but the problem still persists. Inspecting the HTML shows the generated hrefs are relative and unusual, eg:

<a href="../../../../../../../../../../../../../../job/myjob">myjob</a>

I can get it working by editing like this:

<a href="../job/myjob">myjob</a>

I've also noticed the below search text help appear after a search. I don't see that on other instances of Jenkins I have access to. Is this enabled by configuration / plugin perhaps?

enter image description here

POSSIBLE SOLUTION: so the image above is the nested-view plugin. Issues have been reported with this, eg:

https://issues.jenkins.io/browse/JENKINS-65924

I rolled back the plugin from 1.20 to 1.17 and now have the more familiar search functionality back and working. phew.

3 Answers

Had the same issue. Downgraded nested-view to 1.19 from 1.21 and search issue went away.

nested-view v1.24 (diff) allows restoring default search behavior by creating a file named ~/.nestedViewsSearch on the Jenkins controller.

This takes effect immediately; it is not necessary to restart the controller.

Related