From c4313840c36783ff818aaf88d41b7054034cd282 Mon Sep 17 00:00:00 2001 From: Varun Lodaya Date: Mon, 17 Aug 2015 15:30:21 -0700 Subject: [PATCH] Set HTTP X-Forward-For option as default in HAProxy config. This change adds the option forwardfor field under frontend section in haproxy config file for HTTP and HTTPS protocols. This will make sure that client's IP is always forwarded to server in request header. Change-Id: I8bc9bc1e70285e5a4f1b3eba2ceff51d7229d45d Closes-Bug: #1485782 --- src/vnsw/agent/oper/loadbalancer_haproxy.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/vnsw/agent/oper/loadbalancer_haproxy.cc b/src/vnsw/agent/oper/loadbalancer_haproxy.cc index ab960b568f8..a7e72252cef 100644 --- a/src/vnsw/agent/oper/loadbalancer_haproxy.cc +++ b/src/vnsw/agent/oper/loadbalancer_haproxy.cc @@ -126,6 +126,12 @@ void LoadbalancerHaproxy::GenerateFrontend( *out << string(4, ' ') << "maxconn " << vip.connection_limit << endl; } + + if (vip.protocol == "HTTP" || vip.protocol == "HTTPS") { + *out << string(4, ' ') + << "option forwardfor" << endl; + } + *out << endl; }