chrisst
chrisst

Reputation: 1766

How can I redirect all http traffic to https

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?

Upvotes: 6

Views: 12330

Answers (3)

yaromir
yaromir

Reputation: 385

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

Upvotes: 2

ravi creed
ravi creed

Reputation: 401

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?"

Upvotes: 0

sti
sti

Reputation: 11075

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

Upvotes: 3

Related Questions