When Jenkins CLI endpoint is reached through URL that redirects to the correct one by 302 HTTP status, following happens (Apache redirecting HTTP to HTTPS):
Warning: received junk from http://JENKINS_HOST/cli/crumbIssuer/api/xml/?xpath=concat(//crumbRequestField,":",//crumb) <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>302 Found</title> </head><body> <h1>Found</h1> <p>The document has moved <a href="https://JENKINS_HOST/cli/crumbIssuer/api/xml/?xpath=concat(//crumbRequestField,%22:%22,//crumb)">here</a>.</p> <hr> <address>Apache/2.2.15 (Red Hat) Server at mwqa-jenkins.rhev-ci-vms.eng.rdu2.redhat.com Port 80</address> </body></html> Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1 at hudson.cli.FullDuplexHttpStream$CrumbData.getData(FullDuplexHttpStream.java:121) at hudson.cli.FullDuplexHttpStream$CrumbData.<init>(FullDuplexHttpStream.java:113) at hudson.cli.FullDuplexHttpStream$CrumbData.<init>(FullDuplexHttpStream.java:104) at hudson.cli.FullDuplexHttpStream.<init>(FullDuplexHttpStream.java:61) at hudson.cli.CLI.connectViaHttp(CLI.java:156) at hudson.cli.CLI.<init>(CLI.java:130) at hudson.cli.CLIConnectionFactory.connect(CLIConnectionFactory.java:72) at hudson.cli.CLI._main(CLI.java:471) at hudson.cli.CLI.main(CLI.java:387)
Wire interaction:
010.040.204.174.46296-010.008.063.243.00080: GET /cli/ HTTP/1.1 User-Agent: Java/1.8.0_131 Host: JENKINS_HOST Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 Connection: keep-alive 010.008.063.243.00080-010.040.204.174.46296: HTTP/1.1 302 Found Date: Fri, 19 May 2017 07:43:51 GMT Server: Apache/2.2.15 (Red Hat) Location: https://JENKINS_HOST/cli/ Content-Length: 352 Connection: close Content-Type: text/html; charset=iso-8859-1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>302 Found</title> </head><body> <h1>Found</h1> <p>The document has moved <a href="https://JENKINS_HOST/cli/">here</a>.</p> <hr> <address>Apache/2.2.15 (Red Hat) Server at JENKINS_HOST Port 80</address> </body></html> 010.040.204.174.46298-010.008.063.243.00080: GET /cli/crumbIssuer/api/xml/?xpath=concat(//crumbRequestField,":",//crumb) HTTP/1.1 User-Agent: Java/1.8.0_131 Host: JENKINS_HOST Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 Connection: keep-alive 010.008.063.243.00080-010.040.204.174.46298: HTTP/1.1 302 Found Date: Fri, 19 May 2017 07:43:51 GMT Server: Apache/2.2.15 (Red Hat) Location: https://JENKINS_HOST/cli/crumbIssuer/api/xml/?xpath=concat(//crumbRequestField,%22:%22,//crumb) Content-Length: 422 Connection: close Content-Type: text/html; charset=iso-8859-1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>302 Found</title> </head><body> <h1>Found</h1> <p>The document has moved <a href="https://JENKINS_HOST/cli/crumbIssuer/api/xml/?xpath=concat(//crumbRequestField,%22:%22,//crumb)">here</a>.</p> <hr> <address>Apache/2.2.15 (Red Hat) Server at JENKINS_HOST Port 80</address>
- links to
It seems that remoting transport mode performs the redirection except when between different protocols (which seems to security feature of JDK) in which case it complains clearly. EDIT: It does not, it was just picking the port number header from the redirect page and then continued on TCP level...
Ssh transport mode does not follow redirects and complain about missing port. Http transport fails with the attached exception (after not following the redirect).