Tuesday 12 July 2016

How to add http / https proxy and http non proxy to Jenkins via Tomcat server?

Introduction :

Generally, the internet is not allowed inside companies network. Sometimes web applications may be required to connect the internet to update some Webservices. We had a requirement to trigger remote parameterized Jenkins job through the internet from current Jenkin’s job which is behind organisation network. This can be achieved by installation Parameterized Remote trigger plugin in Jenkins, but the challenge is no internet. we can trigger remote Jenkins job via HTTP proxy.
There are different ways to implement HTTP proxy and HTTP non-proxy. One way is adding HTTP proxy to java source code of Parameterized Remote trigger plugin. Another way is adding HTTP proxy to tomcat. The advantage of adding HTTP proxy to tomcat is, the HTTP proxy can be available to all java web applications / Jenkins plugins running on tomcat. This can be achieved by adding small configuration to ../conf/catalina.properties and ../bin/catalina.sh files. This is very simple, straight forward and easy to implement.

Tomcat settings for http proxy :

File : ../conf/catalina.properties
#http proxy host setup
http.proxyHost=xx.xx.xx.com
http.proxyPort=8082

https.proxyHost=xx.test.xx.com
https.proxyPort=8081

#we can bypass http non proxy urls. 
http.nonProxyHosts=*.company.org
File : ../bin/catalina.sh
JAVA_OPTS="$JAVA_OPTS -Dhttp.proxySet=true"

JAVA_OPTS="$JAVA_OPTS -Dhttp.proxyHost=xx.xx.xx.com"

JAVA_OPTS="$JAVA_OPTS -Dhttp.proxyPort=8082"

JAVA_OPTS="$JAVA_OPTS -Dhttp.nonProxyHosts=*.company.org"

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home