Tuesday, May 17, 2016

iptables - Redirect from http to https

I have a Hudson/Jenkins installation which runs on port 443, so I can access it with https://ci.mydomain.com.
I do not have a webserver running on port 80 like Apache Httpd, but I want if a user types http://ci.mydomain.com
it should be redirected to https://...



I tried it with iptables:




/sbin/iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 443
/sbin/iptables-save
chkconfig --level 35 iptables on


But the browser tells me, that the connection failed. So I do not want to install Apache webserver, I only
want to have a redirect from http://ci.mydomain.com to https://ci.mydomain.com.

No comments:

Post a Comment