I am running Jenkins on squeeze through the default winstone container and I would like to redirect all calls to http://jenkins-server to https://jenkins-server. Is there a way I can do this without running Jenkins through apache, etc?
-
I know it's been a few years, and I'm about to try this myself, but Jenkins runs on Tomcat, according to this documentation: http://support.irise.com/customer/portal/articles/602690-redirecting-http-to-https-in-tomcat It should be easy to modify the tomcat configuration to redirect. – rleibman Jul 25 '14 at 00:31
-
@rleibman That page isn’t here anymore – 3h4x Oct 11 '17 at 11:28
3 Answers
At least you need something that would sit in port 80 and redirect browsers to https://jenkins-server. Jenkins does not have this capability built-in.
See Jenkins command-line options at https://wiki.jenkins-ci.org/display/JENKINS/Starting+and+Accessing+Jenkins

- 11,047
- 1
- 27
- 27
Jenkins can do it natively since some recent versions.
Add --httpsRedirectHttp
parameter when starting Jenkins.
Typically it is configured as a systemd service. Edit /lib/systemd/system/jenkins.service
, modify exec line:
ExecStart=/usr/bin/jenkins --httpsRedirectHttp
If you want to bind Jenkins to 80 and 443 ports, you will need to set capability to JVM running Jenkins (which might be a security risk):
sudo setcap CAP_NET_BIND_SERVICE=+eip /path/to/java

- 378
- 7
- 17
First you have to generate certificate (both public and private) on your jenkin name (may be localhost) and import public certificate into your browser. Parallely host your jenkin using the certificate you have generated (which may be in JKS format containing both public and private key).
Refer for more info "Enable HTTPS in jenkins?"

- 371
- 3
- 6