2 questions:
*First question*:
I have haproxy loadbalancer running with 2 backend servers. Both backend
nginx servers have EXACTLY similar configurations.
Here is my haproxy configuration:
frontend regroup
bind *:80
bind *:443 ssl crt /etc/haproxy/test.pem
acl is_test1 hdr_reg(host) -i test1.com
acl is_test2 hdr_reg(host) -i test2.com
block unless is_test1 or is_test2
acl is_welcome path_beg /welcome
use_backend wordpress if is_welcome
default_backend main
backend wordpress
mode http
balance roundrobin
option httpclose
option abortonclose
option forwardfor
option httpchk HEAD /welcome/check.txt HTTP/1.0
fullconn 2000
server backend1 10.0.0.1:8888 minconn 20 maxconn 400 check
server backend2 10.0.0.2:8888 minconn 20 maxconn 400 check
backend main
mode http
balance roundrobin
option httpclose
option abortonclose
option forwardfor
option httpchk HEAD /check.txt HTTP/1.1
fullconn 2000
server backedn1 10.0.0.1:8888 minconn 20 maxconn 400 check
server backend2 10.0.0.2:8008 minconn 20 maxconn 400 check
Now the problem is haproxy doesn't seems to identify individual websites in
backend1 server, it takes only default one (takes first server_name in
nginx to be exact no matter how many server_name are configured in backend1
nginx). So if someone request test1.com it look for the file
/welcome/check.txt in wrong root folder and then mark backend1 as down.
If I point the sites to nginx backend IP address, its working fine. So it
looks either
haproxy is not sending headers to backend1 server
or
backend1 server is unable to identify the headers sent by haproxy.
PS: both backend servers has exactly same configuration.
Hope I made the scenario clear.
- *Second question*
Many thanks to the team for setting up SSL support. I ran it on test
environment and it works great so we are planning to move it to production.
My question is, is there any way to redirect all http requests to https
within haproxy.?