Some hyperlinks don’t work on Jenkins

Article ID:215787857
1 minute readKnowledge base

Issue

Some hyperlinks don’t work on Jenkins

Environment

  • CloudBees Jenkins Enterprise

  • CloudBees Jenkins Operations Center

Resolution

This is most of the times due a misconfiguration on the haproxy or load balancer.

Use the following script below to check that:

  1. hyperlinkMatchesCurrentPage works fine on Jenkins core

  2. The Url is right so there are not any double slash // or incorrect characters.

import org.kohsuke.stapler.Stapler;

def jenkins = jenkins.model.Jenkins.getInstance();

h = new hudson.Functions();

String url = Stapler.getCurrentRequest().getRequestURL().toString();
url = java.net.URLDecoder.decode(url,"UTF-8");
if (url.endsWith("/")) url = url.substring(0, url.length() - 1);

println "url = " + url;
println "hyperlinkMatchesCurrentPage work? = " + h.hyperlinkMatchesCurrentPage("/script")