title: HAProxy redirect scheme in backend not working
body: <p>I have a haproxy cluster with two frontends for http and https and many backends which are selected using a domain2backend map.</p>
  
  <p>Some of the backends must be accessed only through HTTPS.</p>
  
  <p>I tried using <code>redirect scheme https code 301 if !{ ssl_fc }</code> in those backends but haproxy seems to be ignoring it. I even tried simply to redirect (without any condition) but haproxy ignores the redirect in the backend section. </p>
  
  <p>Configuration excerpt:</p>
  
  <pre><code>global
      maxconn 1024
      debug
      log localhost local0 debug
      tune.ssl.default-dh-param 2048
  
  defaults
      balance roundrobin
      maxconn 32
      log global
      monitor-uri /haproxy_test
      timeout connect 5000ms
      timeout client 50000ms
      timeout server 50000ms
  
  frontend http-in
      bind *:8080
      mode http
      option httplog
      option forwardfor
      use_backend %[req.hdr(host),lower,map_dom(./etc/domain2backend.map)]
  
  frontend https-in
      bind *:4443 ssl crt ./etc/ssl
      mode http
      option httplog
      option forwardfor
      http-request add-header X-Proto https if { ssl_fc }
      use_backend %[req.hdr(host),lower,map_dom(./etc/domain2backend.map)]
  
  backend app1_www
      redirect scheme https if !{ ssl_fc }
      server localhost:3000 127.0.0.1:3000 check
  
  backend app2_www
      redirect scheme https
      server localhost:3000 127.0.0.1:3000 check
  </code></pre>
  
  <p>Neither app1_www nor app2_www redirects work.</p>
  
  <p>I am using HA-Proxy version 1.7.3 2017/02/28</p>