3

I'd like to have my system automatically take me to https://facebook.com even if I put http://facebook.com into my browser. I can get /etc/hosts to redirect to me to different domains, but it seems to ignore it if I put https:// into it.

This works, and it redirects facebook.com to google.com:

74.125.95.103    facebook.com

This does not

https://74.125.95.103   facebook.com

My guess is that you can't use text at all in the part where the IP is, but how do I force it to use https? Is this possible in iptables?

1
  • Since this question was asked, many website such as Facebook now redirect to https by default.
    – spuder
    Jan 20, 2014 at 7:38

1 Answer 1

6

No, it is not possible using iptables.

If you used it to redirect port 80 to port 443, your browser would still speak to it using http rather than https, and all you would get is garbage.

Maybe something using a Squid proxy would work. You could make it a transparent proxy if you can't change everyone's proxy settings.

Or, if it's just for Facebook, there is a new per-user setting to force HTTPS that might work for you when it is rolled out.

Or, if you're using Firefox, check out HTTPS Everywhere.

2
  • 1
    To further @Mikel's comments about why it wouldn't work: The browser is speaking HTTP to port 80. You'd need to somehow convince the browser that it visited a web server that returned a 302 status return, which would redirect the browser to the SSL page.
    – jsbillings
    Jan 28, 2011 at 14:32
  • 1
    If you're using Firefox, you can also install the NoScript addon, which has a setting that allows you to force the use of HTTPS on whatever domains you specify. See ghacks.net/2010/10/31/how-to-force-https-connections for details.
    – glomad
    Feb 15, 2011 at 19:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .