I have gone through various answers on this forum and others and tried to debug my HAProxy configuration- alas no success. I am newbie at HAProxy and am facing challenges getting it to work the way I want. Here is the context. I would like a client browser to hit the IP of the HAProxy server 1.2.3.4 with a path specified like 1.2.3.4/login and this should forward the connection to abcd.com/login but not expose the abcd.com server to the end client browser. All traffic should go through the HAProxy server. In trying to achieve this, what I need to do is build a system such that the end client types in https/http://1.2.3.4/login and the client should then see content from https://abcd.com/login. if they type just https/http://1.2.3.4 they should get content from https//abcd.com . This is my config:
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
defaults
log global
option tcplog
mode tcp
timeout connect 10s
timeout client 20s
timeout server 20s
timeout client-fin 20s
timeout tunnel 1h
resolvers mydns
nameserver dns1 1.0.0.1:53
nameserver dns2 1.1.1.1:53
resolve_retries 3
timeout resolve 1s
timeout retry 1s
hold other 30s
hold refused 30s
hold nx 30s
hold timeout 30s
hold valid 10s
hold obsolete 30s
frontend https
bind *:80
bind *:443
mode tcp
acl login-end-point path_beg /login
use_backend abcd_login if login-end-point default_backend bk_app
backend bk_app
option http_proxy
option httpclose
option ssl-hello-chk
mode tcp
server site www.abcd.com:443 resolvers mydns
backend abcd_login
option http_proxy
option httpclose
option ssl-hello-chk
mode tcp
server abcdpanel abcd.com:443 resolvers mydns
# Map url path as ProxyPass does
reqirep ^(GET|POST|HEAD)\ /login/(.*) \1\ /\2
# Rewrite redirects as ProxyPassReverse does
acl response-is-redirect res.hdr(Location) -m found
rspirep ^Location:\ (http|https)://abcd.com\/(.*) Location:\ \1://abcd.com/login/\2 if response-is-redirect
I checked to see that HAProxy is listening on both port 80 and 443
sudo netstat -tulpn | grep 443
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 29464/haproxy
sudo netstat -tulpn | grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 29464/haproxy
a
wget --no-check-certificate http://1.2.3.4 gives --2018-11-14 06:01:26-- http://1.2.3.4/ Connecting to 1.2.3.4:80... connected. HTTP request sent, awaiting response... No data received. Retrying.
Trying https with the above gives Unable to establish SSL connection. Adding a /login to 1.2.3.4 request makes no difference.
I would really appreciate any guidance on where I can fix the error.