I don’t know about docker or centos, but haproxy -vv should always work. The acme validation plugin needs haproxy 1.6 with Lua, there is no point in trying with 1.5.
Hey @lukastribus just coming back to report this has now all be set up - massive thanks for your help! I have also edited the first post with a summary - hopefully it will help others without them having to read the whole thread.
Just one last question, what would be the best way to force https on my some of my sites? (Some of those defined under ‘Define hosts’ and some that use the default_backed.)
Here is a reminder of what I have:
frontend http-in
bind *:80
default_backend main_apache_sites
# Define hosts
redirect prefix http://discourse-forum-1.com code 301 if { hdr(host) -i www.discourse-forum-1.com }
acl host_discourse hdr(host) -i discourse-forum-1.com
redirect prefix http://discourse-forum-2.com code 301 if { hdr(host) -i www.discourse-forum-2.com }
acl host_discourse_2 hdr(host) -i discourse-forum-2.com
redirect prefix http://discourse-forum-3.com code 301 if { hdr(host) -i www.discourse-forum-3.com }
acl host_discourse_3 hdr(host) -i discourse-forum-3.com
# which one to use
use_backend discourse_docker if host_discourse
use_backend discourse_docker_2 if host_discourse_2
use_backend discourse_docker_3 if host_discourse_3
backend main_apache_sites
server server1 127.0.0.1:8080 cookie A check
cookie JSESSIONID prefix nocache
backend discourse_docker
server server2 127.0.0.1:8888 cookie A check
cookie JSESSIONID prefix nocache
backend discourse_docker_2
server server2 127.0.0.1:8889 cookie A check
cookie JSESSIONID prefix nocache
backend discourse_docker_3
server server2 127.0.0.1:8890 cookie A check
cookie JSESSIONID prefix no cache
Yes, but in that case I would suggest to use a dedicated (named) ACL to define the list of hosts that need the HTTPS redirect, otherwise the configuration gets messy.
Note that there is no indentation in haproxy really. “redirect” and “acl” can start at the same place as can server and cookie in the backend.
Yes, telling the application that the connection to the client is secured via X-Forwarded-Proto header is the proper thing to do in this case, instead of rewriting response headers at the proxy layer.