I'd like to set HAProxy to redirect web requests for HTTP to HTTPS, but I can't figure out how to do it?
Quote from: Taomyn on March 17, 2017, 02:41:11 pmI'd like to set HAProxy to redirect web requests for HTTP to HTTPS, but I can't figure out how to do it?You need to create an ACL for this. In the current release of our HAProxy plugin it is already possible to select "Traffic is ssl" as ACL expression, but this is quite unreliable.The next release of our HAProxy plugin (1.14) will provide the new expression "SSL/TLS connection established" to detect reliably wether it's a SSL connection or not. (https://github.com/opnsense/plugins/pull/110)When HAProxy plugin version 1.14 is released you'll be able to configure HTTP-to-HTTPS redirects like this:- create new ACL, choose expression "SSL/TLS connection established" (tick the "Negate condition" checkbox)- create new ACTION, choose your new ACL, select action "http-request redirect", add to "Set value": scheme https code 301- add the new action to your HTTP frontend (note that this will NOT work in TCP mode)See the attached screenshots for an example.A little bit complicated for a simple redirect, but I think this is the price one has to pay for the great flexibility that HAProxy has to offer. Regards- Frank