Haproxy SSL Configuration method

Source: Internet
Author: User
Tags ssl certificate haproxy

There are two ways of Haproxy proxy SSL


1, Haproxy itself provides SSL certificate, the back of the Web server go normal http


2, Haproxy itself only provide proxy, the back of the Web server https


The first way


Need to compile Haproxy support SSL, compile parameters:


Make target=linux26 use_openssl=1 Addlib=-lz

LDD Haproxy | grep SSL

libssl.so.10 =/usr/lib64/libssl.so.10 (0x00007fb0485e5000)

Configuration parameters:


Frontend https_frontend

Bind *:443 SSL Crt/etc/ssl/certs/servername.pem

Mode http

Option Httpclose

Option Forwardfor

Reqadd x-forwarded-proto:\ HTTPS

Default_backend Web_server


Backend Web_server

Mode http

Balance Roundrobin

Cookie ServerID Insert Indirect nocache

Server S1 192.168.250.47:80 Check cookie s1

Server s2 192.168.250.49:80 Check cookie s2

Note: The Pem file here is a combination of the following two files:

Cat Servername.crt Servername.key |tee Servername.pem

The second way of configuring


No need to recompile to support SSL, simple and convenient. The following Web server is required to configure SSL.


Frontend https_frontend

Bind *:443

Mode TCP

Default_backend Web_server


Backend Web_server

Mode TCP

Balance Roundrobin

Stick-table Type IP size 200k expire 30m

Stick on SRC

Server S1 192.168.250.47:443

Server S2 192.168.250.49:443

Note that mode must be in the TCP mode


This article is from the "My Ops Time" blog, so be sure to keep this source http://aaronsa.blog.51cto.com/5157083/1741517

Haproxy SSL Configuration method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.