HAProxy redirecting http to https (ssl)

前端 未结 16 1540
你的背包
你的背包 2020-12-22 22:04

I\'m using HAProxy for load balancing and only want my site to support https. Thus, I\'d like to redirect all requests on port 80 to port 443.

How would I do this?<

16条回答
  •  北荒
    北荒 (楼主)
    2020-12-22 23:05

      acl host-example hdr(host) -i www.example.com
    
      # for everything not https
      http-request redirect scheme https code 301 unless { ssl_fc }
    
      # for anything matching acl
      http-request redirect scheme https code 301 if host-example !{ ssl_fc }
    

提交回复
热议问题