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.

  • 1
    Why would there be any https traffic at all? Commented Dec 8, 2012 at 22:37
  • If someone hits up the site with https:// I don't want their request to hit a dead end.
    – tarnfeld
    Commented Dec 8, 2012 at 22:38
  • 1
    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. Commented Dec 8, 2012 at 23:04

2 Answers 2


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.

  • Bah! Of course. Nevermind.
    – tarnfeld
    Commented Dec 8, 2012 at 23:45

Yes you can, just put the redirect rule in your ssl frontend for the host... something like this

redirect scheme http if { hdr(Host) -i the.host.com } { ssl_fc }
  • 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.
    – AnthonyK
    Commented Aug 16, 2020 at 2:26

You must log in to answer this question.

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