Enable HTTP_X_FORWARDED_FOR in Haproxy

By default, Haproxy won’t forward visitor IP address to backend servers. To enable Haproxy forward visitor IP address to backend server using HTTP_X_FORWARDED_FOR header, edit haproxy.cfg vi /etc/haproxy/haproxy.cfg Add option forwardfor This can be added in blocks defaults, frontend, backend or listen. Example backend be_lamp mode http log global option forwardfor server fapi 10.0.3.106:80

Enable SSL in Haproxy Docker Container

I have a haproxy container running on port 80. This container is started with command docker run -d -p 80:80 –name haproxy1 -v /home/ubuntu/haproxy:/usr/local/etc/haproxy:ro haproxy:1.7 This haproxy used following configuration file /home/ubuntu/haproxy/haproxy.cfg global defaults frontend sok-front-end bind *:80 mode http default_backend sok-front-end backend sok-front-end mode http balance roundrobin server srv3 172.17.0.2:8000 To make this haproxy … Read more

Haproxy Site With SSL

To handle SSL/HTTPS traffic on haproxy, use following config in your /etc/haproxy/haproxy.cfg file. frontend https-frontend-new bind :::443 ssl crt domain.pem acl https ssl_fc http-request set-header X-Forwarded-Proto http if !https http-request set-header X-Forwarded-Proto https if https option forwardfor acl secured_cookie res.hdr(Set-Cookie),lower -m sub secure http-response replace-header Set-Cookie (.*) \1;\ secure if https !secured_cookie default_backend https-backend-new backend … Read more

haproxy

To install haproxy on Ubuntu, run Haproxy config file is located at Enable HTTP_X_FORWARDED_FOR in HaproxyShow X-Forwarded-For IP in ApacheHaproxy Site With SSLEnable SSL in Haproxy Docker Container