Alena
Alena

Reputation: 29

Jenkins: IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 407 Proxy Authentication Required"

First of all I want to tell that this question isn´t duplicate.

I want to install plugin in Jenkins. I went to Update Center but I can´t install anything because I have this error:

IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 407 Proxy Authentication Required".

Here is how my error looks like in Update Center.

Also when it comes to Java, I have Java for 64 bit.

I tried changing JRE folder and putting there things for JRE 64 bit because Jenkins installs 32bit but it doesn't work. How could I solve this problem?

Upvotes: 1

Views: 13515

Answers (1)

Scotty
Scotty

Reputation: 86

TL;DR

java -Dhttp.proxyHost=THE_PROXY_HOST_NAME -Dhttp.proxyPort=PORT_NUMBER -Dhttp.proxyUser=USER_NAME -Dhttp.proxyPassword=MY_SUPER_SECRET_PASSWORD -Dhttp.auth.preference=basic -Djdk.http.auth.tunneling.disabledSchemes= -jar jenkins.war



Hopefully you've figured it out by now, but for those looking for an answer (myself in the near future)...

I did a lot of things and I'm not sure what really ended up working, but here's what I think worked for me and what I actually did.

What I think works

Jenkins has known bugs with proxy settings from JENKINS-58567, JENKINS-56498, JENKINS-48775, etc. So here's what I think works:

Set Java proxy settings

Depending on how you're running Jenkins (i.e. running java -jar jenkins.war or as a daemon systemctl start jenkins.service) you're going to have to supply the proxy configuration as a Java option.

I'm running this as a daemon so I added my options in /etc/sysconfig/jenkins (I have no idea where this lives in Windows) under JENKINS_JAVA_OPTIONS and added the following java options:

-Dhttp.proxyHost=THE_PROXY_HOST_NAME -Dhttp.proxyPort=PORT_NUMBER -Dhttp.proxyUser=USER_NAME -Dhttp.proxyPassword=MY_SUPER_SECRET_PASSWORD -Dhttp.auth.preference=basic -Djdk.http.auth.tunneling.disabledSchemes=

I'm guessing that I can probably do -Djdk.http.auth.tunneling.disabledSchemes=Basic instead of Dhttp.auth.preference=basic -Djdk.http.auth.tunneling.disabledSchemes= based on this posted comment, but I'm lazy and don't feel like testing this out (I'll come back to refine this answer someday).

What I actually did

Apart from the aforementioned steps, I did some weird things (I was pretty desperate, I had gone 4 months without updating plugins).

  • Added an export command to my startup script in /etc/rc.d/init.d/jenkins
    • export HTTP_PROXY=http://username:password@your-proxy-server:port
  • Added a global variable on Jenkins > Manage Jenkins > Configure System > Global Properties > Checkbox Environment Variable > Add a variable name HTTP_PROXY and value http://username:password@your-proxy-server:port

I can't remember what else I ended up doing, but I don't think they're important (since they didn't work).

Best of luck!

Upvotes: 7

Related Questions