It's all about the answers!

Ask a question

How do you configure Jenkins to work with a proxy server?

Stephane Couillaud (15632344) | asked Jan 11 '16, 5:31 p.m.
We are facing some issues using a proxy server (i.e. caching server) with Jenkins and was hoping someone could provide insight if they have a similar setup in place.   Here’s a brief description of our setup:

At primary site A we have a reverse proxy, JTS & CCM server.  At remote site B, we have a proxy server, using Squid for caching, to improve loading times of our source code.  Site B also has a Jenkins server configured to manage our builds.

To leverage the proxy server all a user has to do on his or her host is:

1.       Open Internet Explorer

2.       Go to Internet Options  and select the Connections tab

3.       Select LAN settings

4.       Enter the Proxy server host name and port in the configuration below

This works great outside of Jenkins (i.e. using Visual Studio).   If we implement the same solution on the Jenkins server, and run a job it completely ignores the proxy settings in IE.  I turned to two other solutions I saw in various postings but the proxy server is still being ignored by Jenkins.  The other two solutions are as follows:

Solution #1

1.       Log on to your Jenkins GUI

2.       Select Manage Jenkins

3.       Select Manage Plugins


4.       Select the Advanced tab

5.       Enter the proxy server host name and port number

6.       Click on the Advanced… button and validate the test URL . If all works then submit to save.

7.       Restart Jenkins, verity that the proxy settings are still set, and perform a workspace load with a Jenkins job to test

Solution #2

1.       Log on to your Jenkins master host.

2.       Go to the installation directory for Jenkins (i.e. C:\Program Files (x86)\Jenkins)

3.       Make a copy of the jenkins.xml file as a backup

4.       Edit jenkins.xml and add the following two arguments for starting jenkins:

-Dhttp.proxyHost=http://ProxyServerName -Dhttp.proxyPort=3128

In the file the XML looks as follows:




  <description>This service runs Jenkins continuous integration system.</description>

  <env name="JENKINS_HOME" value="%JENKINS_HOME%"/>


    if you'd like to run Jenkins with a specific version of Java, specify a full path to java.exe.

    The following value assumes that you have java in your PATH.



  <arguments> -Dhttp.proxyHost=http://ProxyServerName -Dhttp.proxyPort=3128 -Xrs -Xmx256m -Djava.library.path="C:\natives;%Path% " -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war"</arguments>


  <onfailure action="restart" />


5.       Save the file, restart Jenkins, and perform a workspace load with a Jenkins job to test

Both solutions fail to leverage our proxy server to cache source code.   Any idea what we could be doing wrong?  Is this even the right place to set the proxy setting for Jenkins to leverage a caching server?


Accepted answer

permanent link
Stephane Couillaud (15632344) | answered Jan 14 '16, 7:17 p.m.
 For those wanting to know the fix was to modify the file jenkins.xml where the argument -Dhttp.proxyHost should have had a value of "ProxyServerName" and NOT "http://ProxyServerName". 
Ralph Schoon selected this answer as the correct answer

Your answer

Register or to post your answer.