Hi, Le mar. 21 avr. 2020 à 12:56, Tim Düsterhus <t...@bastelstu.be> a écrit :
> Olivier, > > PS: Personal opinion, but I prefer quotes in replies to be shortened as > much as possible, while still providing context. I don't want to scroll > through kilobytes of stuff I've already seen :-) > ;) Patch updated attached.
From e6b11f3a795ec40c8b802d9d1190f3f6bbd15f5d Mon Sep 17 00:00:00 2001 From: Olivier Doucet <oliv...@oxeva.fr> Date: Tue, 21 Apr 2020 09:32:56 +0200 Subject: [PATCH] DOC: Improve documentation on http-request set-src This patch adds more explanation on how to use "http-request set-src" and a link to "option forwardfor". This patch can be applied to all previous version starting at 1.6 --- doc/configuration.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git doc/configuration.txt doc/configuration.txt index 5d01835d7..e695ab7f5 100644 --- doc/configuration.txt +++ doc/configuration.txt @@ -5114,16 +5114,23 @@ http-request set-src <expr> [ { if | unless } <condition> ] This is used to set the source IP address to the value of specified expression. Useful when a proxy in front of HAProxy rewrites source IP, but provides the correct IP in a HTTP header; or you want to mask source IP for - privacy. + privacy. All subsequent calls to "src" fetch will return this value + (see example). Arguments : <expr> Is a standard HAProxy expression formed by a sample-fetch followed by some converters. + See also "option forwardfor". + Example: http-request set-src hdr(x-forwarded-for) http-request set-src src,ipmask(24) + # After the masking this will track connections + # based on the IP address with the last byte zeroed out. + http-request track-sc0 src + When possible, set-src preserves the original source port as long as the address family allows it, otherwise the source port is set to 0. -- 2.18.0.windows.1