# HTTPS redirection not working

**URL:** <https://discourse.haproxy.org/t/https-redirection-not-working/4370>\
**Category:** Help!\
**Created:** [October 7, 2019, 3:17am UTC](https://discourse.haproxy.org/t/https-redirection-not-working/4370 "2019-10-07T03:17:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![abarber](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@abarber](https://discourse.haproxy.org/u/abarber)\
**Post date:** [October 7, 2019, 3:17am UTC](https://discourse.haproxy.org/t/https-redirection-not-working/4370/1 "2019-10-07T03:17:26Z")

</div>

We are currently running HA-Proxy version 1.5-dev18 2013/04/03 as a reverse proxy for some websites and a VMWare View enviroment.  
The issue we are experiencing is that all our sites in the backend are HTTPS and even though we have an HTTP and HTTPS front end configured with http-request redirect scheme https code 301 if !{ ssl\_fc } in the HTTP front end, when a user goes to [http://site1.com](http://site1.com) they are not redirected to [https://site1.com](https://site1.com)

I believe it to be something to do with our HTTPS front end looking for the sni but i am more than likely wrong.

i have included the config to see if anyone can see anything obvious.

> global  
> maxconn 4096  
> pidfile /var/run/haproxy.pid  
> daemon  
> log 127.0.0.1 local0  
> log 127.0.0.1 local1 notice  
> stats socket /var/run/haproxy.stat mode 600  
> user haproxy  
> group haproxy
> 
> defaults  
> # log 127.0.0.1:514 local0 debug  
> # log 127.0.0.1:514 local1  
> mode tcp  
> retries 3  
> option redispatch  
> maxconn 2000  
> contimeout 5000  
> clitimeout 50000  
> srvtimeout 50000  
> #stats enable  
> #stats auth admin:admin
> 
> userlist UsersFor\_HAProxyStatistics  
> group admin users haproxy  
> user haproxy insecure-password  
> user stats insecure-password
> 
> listen stats \*:1936  
> mode http  
> stats enable  
> #stats scope http  
> #stats scope www  
> #stats scope static  
> #stats scope static\_httpclose  
> #stats realm Haproxy\ Statistics  
> stats uri /haproxy?stats  
> #stats auth haproxy:  
> stats refresh 20s  
> stats show-node  
> stats show-legends  
> acl AuthOkay\_ReadOnly http\_auth(UsersFor\_HAProxyStatistics)  
> acl AuthOkay\_Admin http\_auth\_group(UsersFor\_HAProxyStatistics) admin  
> stats http-request auth realm HAProxy-Statistics unless AuthOkay\_ReadOnly  
> stats admin if AuthOkay\_Admin
> 
> frontend inbound-http \*:80  
> mode http  
> http-request redirect scheme https code 301 if !{ ssl\_fc }
> 
> frontend test :443  
> mode tcp  
> #log global
> 
> tcp-request inspect-delay 5s  
> tcp-request content accept if { req\_ssl\_hello\_type 1 }  
> use\_backend 1\_BE if { req\_ssl\_sni -i [yourdomain.com](http://yourdomain.com) }  
> use\_backend 1\_BE if { req\_ssl\_sni -i [yourdomain1.com](http://yourdomain1.com) }  
> use\_backend 2\_BE if { req\_ssl\_sni -i [yourdomain2.com](http://yourdomain2.com) }  
> use\_backend 3\_BE if { req\_ssl\_sni -i [yourdomain3.com](http://yourdomain3.com) }  
> use\_backend 4\_BE if { req\_ssl\_sni -i [yourdomain4.com](http://yourdomain4.com) }  
> use\_backend 5\_BE if { req\_ssl\_sni -i [yourdomain5.com](http://yourdomain5.com) }  
> use\_backend 6\_BE if { req\_ssl\_sni -i [yourdomain6.com](http://yourdomain6.com) }  
> use\_backend 7\_BE if { req\_ssl\_sni -i [yourdomain7.com](http://yourdomain7.com) }  
> use\_backend 7\_BE if { req\_ssl\_sni -i [yourdomain8.com](http://yourdomain8.com) }  
> use\_backend 7\_BE if { req\_ssl\_sni -i [yourdomain9.com](http://yourdomain9.com) }  
> use\_backend 7\_BE if { req\_ssl\_sni -i [yourdomain10.com](http://yourdomain10.com) }  
> use\_backend 7\_BE if { req\_ssl\_sni -i [yourdomain11.com](http://yourdomain11.com) }  
> use\_backend 7\_BE if { req\_ssl\_sni -i [yourdomain12.com](http://yourdomain12.com) }  
> use\_backend 7\_BE if { req\_ssl\_sni -i [yourdomain13.com](http://yourdomain13.com)}  
> use\_backend 7\_BE if { req\_ssl\_sni -i [yourdomain14.com](http://yourdomain14.com)}  
> use\_backend 7\_BE if { req\_ssl\_sni -i [yourdomain15.com](http://yourdomain15.com)}  
> use\_backend 7\_BE if { req\_ssl\_sni -i [yourdomain16.com](http://yourdomain16.com)}  
> use\_backend 8\_BE if { req\_ssl\_sni -i [yourdomain17.com](http://yourdomain17.com)}  
> use\_backend 9\_BE if { req\_ssl\_sni -i [yourdomain18.com](http://yourdomain18.com)}  
> use\_backend 10\_EX\_BE if { req\_ssl\_sni -i [yourdomain19.com](http://yourdomain19.com)}  
> default\_backend 1\_BE
> 
> backend 1\_BE  
> mode tcp  
> option tcplog  
> option ssl-hello-chk #make sure we can talk SSL, not just TCP  
> balance source  
> server [serverName1] [serverip]:443 check id 1 inter 10s rise 5 fall 2  
> server [serverName2] [serverip]:443 check id 2 inter 10s rise 5 fall 2
> 
> backend 2\_BE  
> #log global  
> server [serverName3] [serverip]:443
> 
> backend 9\_BE  
> #log global  
> server [serverName4] [serverip]:443
> 
> backend 3\_BE  
> #log global  
> server [serverName5] [serverip]:443
> 
> backend 4\_BE  
> #log global  
> server [serverName6] [serverip]:443
> 
> backend 5\_BE  
> #log global  
> server [serverName7] [serverip]:443
> 
> backend 6\_BE  
> #Log global  
> server [serverName8] [serverip]:443
> 
> backend 7\_BE  
> #Log global  
> server [serverName9] [serverip]:443
> 
> backend 8\_BE  
> #log global  
> server [serverName10] [serverip]:443
> 
> backend 10\_EX\_BE  
> #log global  
> server [serverName11] [serverip]:443

---

<div class="post-metadata">

**Author:** ![abarber](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@abarber](https://discourse.haproxy.org/u/abarber)\
**Post date:** [October 14, 2019, 6:07am UTC](https://discourse.haproxy.org/t/https-redirection-not-working/4370/2 "2019-10-14T06:07:50Z")

</div>

is it possible that due to the 443 frontend being in tcp mode it doesn’t work??  
But there is a http frontend on port 80

---

<div class="post-metadata">

**Author:** ![abarber](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@abarber](https://discourse.haproxy.org/u/abarber)\
**Post date:** [October 15, 2019, 12:07am UTC](https://discourse.haproxy.org/t/https-redirection-not-working/4370/3 "2019-10-15T00:07:02Z")

</div>

fixed it… it was our mistake.  
We had not port forwarded port 80 to the HA Proxy (Yeah I know!!!)

---

<div class="post-metadata">

**Author:** ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)\
**Post date:** [October 15, 2019, 1:54pm UTC](https://discourse.haproxy.org/t/https-redirection-not-working/4370/4 "2019-10-15T13:54:32Z")

</div>

Thanks for reporting back, however please note that:

> [@abarber](#):
>
> `1.5-dev18 2013/04/03`

Is a development snapshot from 6 years ago that was never intended to be used for a production service.

I suggest you use stable and released versions instead.
