Jenkins2 on AWS - make a redirect from http to https

You think it would be simple to set up a http redirect on an AWS Marketplace setup for Jenkins2, but it isn't. As it turns out, the instructions from AWS itself are wrong, and so are the instructions from Bitnami!

Here is the redirect that will work. This should be valid for most apache setups on AWS, and then I will show you how to apply it to a Jenkins2 server.

Add this to your apache conf file:

RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} ^http$
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Then restart apache and you should have no problem after that.

To do this for Bitnami's implementation of Jenkins2 on AWS (this is the AWS Marketplace image), do the following:

  1. Add the above change to the top of: /opt/bitnami/apps/jenkins/conf/httpd-prefix.conf
  2. Restart apache:
    sudo /opt/bitnami/ restart apache


No comments:

Post a Comment