HAProxy redirect HTTPS to HTTP

12,820

That won't work. If a user enters https://example.com into their browser and it connects to port 443 then it requires SSL to be there. You can't even cause the redirect without having SSL properly set up.

In other words: if a user already connects to 443 then it's too late for you to avoid proper SSL.

Keeping the port closed is probably the "best" thing you can do - apart from getting SSL setup properly.

Share:
12,820

Related videos on Youtube

tarnfeld
Author by

tarnfeld

Updated on September 18, 2022

Comments

  • tarnfeld
    tarnfeld over 1 year

    I'm using HAProxy as a load balancer and i'd like to redirect any traffic that comes in on 443 (HTTPS) to 80 (HTTP). My site doesn't support HTTPS at all and i'd rather just redirect users than cause any SSL warnings in browsers.

    All I can find is using the redirect location <to> syntax, but as far as I can tell that requires me to hard code the hostname. The load balancer receives connections for various hostnames so would like to keep it relative.

    • Michael Hampton
      Michael Hampton over 11 years
      Why would there be any https traffic at all?
    • tarnfeld
      tarnfeld over 11 years
      If someone hits up the site with https:// I don't want their request to hit a dead end.
    • Christopher Perrin
      Christopher Perrin over 11 years
      They'd still get a certificate warning before the redirect and there is not point serving something that you don't serve ;). Just don't enable https.
  • tarnfeld
    tarnfeld over 11 years
    Bah! Of course. Nevermind.
  • AnthonyK
    AnthonyK almost 4 years
    Yeah, I know, it's many, many moons later, but did you actually try your suggestion before posting? For you to redirect to https, you'd need to bind to port 443 using a proper SSL certificate - remember that's what the browser expects. The OP said his site did not have SSL configured at all and wasn't planning on setting it up.