Proxy setup validation

Issue

  • My Jenkins instance fails to reach some external URLs and it seems networking is correct.

Environment

Resolution

There are some reasons why you have a networking error message when you try to reach an external URL (or an internet resource). One of them is the Connection timeout. If you confirm you are able to reach this external URL from the machine that hosts the Jenkins instance, it’s time to check your proxy configuration if you have a proxy set up in your network environment.

In Jenkins we have three locations where you can set the proxy configuration:

  1. In the Jenkins UI (Manage Jenkins -> Manage Plugins -> Advanced).
  2. In the JVM arguments (-Dhttp.proxyHost, -Dhttp.proxyPort, etc).
  3. In the Plugin Specific Proxy settings (Subversion SCM Plugin, etc).

You should check for the following conditions to ensure your proxy configuration is correct:

  1. You should set at least the host and port field in your proxy configuration. If the host or port field is missing, your current proxy configuration will be incorrect.
  2. You should add any host you want to bypass your proxy configuration in the No Proxy Host field. For the Jenkins UI, you can put each host in each line. For the JVM arguments, you should use the character | to split each host.
  3. You should put the same Host, Port, and No Proxy Host values in each Proxy settings location (Jenkins UI, JVM arguments, and Plugin Specific Proxy Settings).
  4. Probably, you should put the CJOC hostname in the No Proxy Host for the Controller instances. In the most common installations where both instances are located in the same network, you should put the CJOC hostname in the No Proxy Host for the Controller instance in order to bypass the proxy server during the connection between the CJOC instance and the Controller instances.

As you can see in the reference Setting a Proxy Configuration, Jenkins and some plugins rely on proxy settings in different locations and you will face wrong behavior if you set up different proxy values on these locations.

Additionally, please notice you have different proxy settings for HTTP or HTTPS connections from the JVM arguments. You can use the http.proxyHost, http.proxyPort and http.nonProxyHosts for HTTP connections and https.proxyHost, https.proxyPort and https.nonProxyHosts for HTTPS connections. Therefore, you should be very careful setting your proxy configuration in case you have different proxies depending on the connection type (HTTP or HTTPS). Also, please notice you have only one proxy setting for both HTTP and HTTPS connections from the Jenkins UI. Therefore, this feature (different proxies depending on the connection type) is not completely supported by Jenkins.

Reference

Have more questions?

0 Comments

Please sign in to leave a comment.