Gaurav Ojha
Gaurav Ojha

Reputation: 43

Using Haproxy to proxy to a secure site

I am new to Haproxy, and would like to learn how I go about writing the conf file to proxy to a secure website.

I currently am testing from localhost. What I basically want to do is if I enter localhost on my browser, it should proxy it to www.site24x7.com. The site has a SSL certificate. On following the guides, it all always ends in a 400 Bad request. My haproxy.cfg is below.

This is not a complete haproxy.cfg. I am not sure what all to put here. Since site24x7 has its own SSL certificate, do I provide my own cert? (can use a self-signed cert for now). I tried SSL Pass Through with Haproxy as well instead of SSL termination, but similar 400 Bad request.

 frontend www-http
        bind *:80
        reqadd X-Forwarded-Proto:\ http
        default_backend www-backend

 backend www-backend
        #redirect scheme https if !{ ssl_fc } #dont know about this
        server www-1 www.site24x7.com:443 check

Upvotes: 0

Views: 825

Answers (1)

nuster cache server
nuster cache server

Reputation: 1791

server www-1 www.site24x7.com:443 check ssl verify none

Either

curl http://127.0.0.1 -H "Host: www.site24x7.com"

or

mode http
http-request set-header Host www.site24x7.com
server www-1 www.site24x7.com:443 check ssl verify none

Upvotes: 1

Related Questions