2

If we would have an OpenWRT router, would we have a solution for redirecting the users traffit to HTTPS if they would request a plain HTTP website based on domain name?

Example: If the traffic wants to be:

http://unix.stackexchange.com/

then it would be redirected to

https://unix.stackexchange.com/

Do we have to use a proxy for this? Aren't there any iptables magics that can be used to redirect for given domain to HTTPS - preserving the original HTTPS "GET" or "POST", etc. request?

  • You can only do this on basis of IP Address because the Router uses the DNS Settings of itself to resove your address. – eyoung100 Oct 1 '14 at 17:09
1

This is commonly done by the web server itself. The web server would listen for both HTTP and HTTPS requests. Using rewrite rule, the HTTP requests would be rewritten to HTTPS requests and sent back as a redirect to the requester. This would typically be a 301 (Moved Permanently) redirect.

You can not use iptables to do the required redirects.

Some proxies may be able to proxy the request from HTTP to HTTPS, but that would break the security provided by HTTPS.

There may be simple processes which only do redirects that could be used to do the redirects, but I don't see any advantage over having the web server do the redirect.

Some web servers can be configured to treat the HTTP and HTTPS sites as separate entities. Security could be increased by not mapping any secure content on the HTTP site which should only be doing redirects.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.