[MINOR] permit renaming of x-forwarded-for header
Because I needed it in my situation - here's a quick patch to
allow changing of the "x-forwarded-for" header by using a suboption to
"option forwardfor".
Suboption "header XYZ" will set the header from "x-forwarded-for" to "XYZ".
Default is still "x-forwarded-for" if the header value isn't defined.
Also the suboption 'except a.b.c.d/z' still works on the same line.
So it's now: option forwardfor [except a.b.c.d[/z]] [header XYZ]
diff --git a/include/common/defaults.h b/include/common/defaults.h
index da9bdd8..05628e1 100644
--- a/include/common/defaults.h
+++ b/include/common/defaults.h
@@ -108,6 +108,9 @@
#define DEF_CHECK_REQ "OPTIONS / HTTP/1.0\r\n\r\n"
#define DEF_SMTP_CHECK_REQ "HELO localhost\r\n"
+// X-Forwarded-For header default
+#define DEF_XFORWARDFOR_HDR "X-Forwarded-For"
+
/* Default connections limit.
*
* A system limit can be enforced at build time in order to avoid using haproxy
diff --git a/include/types/proxy.h b/include/types/proxy.h
index 415b1a1..03cb5f6 100644
--- a/include/types/proxy.h
+++ b/include/types/proxy.h
@@ -206,6 +206,8 @@
unsigned int maxconn; /* max # of active sessions on the frontend */
unsigned int fullconn; /* #conns on backend above which servers are used at full load */
struct in_addr except_net, except_mask; /* don't x-forward-for for this address. FIXME: should support IPv6 */
+ char *fwdfor_hdr_name; /* header to use - default: "x-forwarded-for" */
+ int fwdfor_hdr_len; /* length of "x-forwarded-for" header */
unsigned down_trans; /* up-down transitions */
unsigned down_time; /* total time the proxy was down */