Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: for the plan.

Jump to: navigation, search

Running Hudson behind Squid

In situations where you want a user friendly url to access Hudson (Not port 8080), it makes sense to have Hudson runs behind Squid, so that you can access Hudson on port 80 or 443. This document discusses some of the approaches for doing this. Squid 2.6

Using Squid 2.6 (default on Centos 5.3):

acl all src
acl localhost src
acl manager proto cache_object
acl to_localhost dst
acl valid_dst dstdomain .YOUR_DOMAIN ci

cache_replacement_policy heap LFUDA
memory_replacement_policy heap GDSF

cache_dir ufs /var/spool/squid 512 16 256
cache_mem 512 MB
maximum_object_size 12000 KB

## http --> https redirect
## don't forget to update "Hudson URL" on https://ci.YOUR_DOMAIN/configure
#acl httpPort myport 80
#http_access deny httpPort
#deny_info https://ci.YOUR_DOMAIN/ httpPort

cache_peer localhost parent 8080 0 originserver name=myAccel
coredump_dir /var/spool/squid
hierarchy_stoplist cgi-bin
http_access allow localhost
http_access allow manager localhost
http_access allow valid_dst
http_access deny all
http_access deny manager

## mkdir /etc/squid/ssl/ && cd /etc/squid/ssl/ # to generate your self-signed certificate
## openssl genrsa -out hudson.key 1024
## openssl req -new -key hudson.key -x509 -out hudson.crt -days 999
http_port 80 vhost
#https_port 443 cert=/etc/squid/ssl/hudson.crt key=/etc/squid/ssl/hudson.key vhost

http_reply_access allow all
icp_access allow all

refresh_pattern -i \.jp(e?g|gif|png|ico)   300  20%  600 override-expire

logformat combined %>a %ui %un \[%tl\] "%rm %ru HTTP/%rv" %Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh
strip_query_terms off
access_log /var/log/squid/access.log combined

visible_hostname ci.YOUR_DOMAIN

This assumes that you run Hudson on localhost port 8080. But you can have it on an other server / different port (adjust line starting with cache_peer)

Of course replace YOUR_DOMAIN with your domain.

With ssl

Remove one level of comment

 sed s/^#// /etc/squid/squid.conf

/!\ If you use the swarm client plugin , the nodes will complain about :

Caused by: PKIX path building failed: unable to find valid certification path to requested target
        ... 13 more
Caused by: unable to find valid certification path to requested target

Fix :


We use Active Directory internally to authenticate our users, it was mandatory to allow https access only.

Back to the top