Re: [squid-users] Hacking X-Forwarded-For

From: Michael Loftis <[email protected]>
Date: Tue, 16 May 2006 15:42:58 -0600

--On May 16, 2006 2:30:29 PM -0700 David Neudorfer <davidneudorfer@mac.com>
wrote:

> I want to customize the X-Forwarded-For header. Building Squid from the
> source files go to line 962 in /src/http.c you will see
>
> /* append X-Forwarded-For */
> strFwd = httpHeaderGetList(hdr_in, HDR_X_FORWARDED_FOR);
> strListAdd(&strFwd,
> (((orig_request->client_addr.s_addr != no_addr.s_addr) &&
> opt_forwarded_for) ?
> inet_ntoa(orig_request->client_addr) : "unknown"), ',');
> httpHeaderPutStr(hdr_out, HDR_X_FORWARDED_FOR, strBuf(strFwd));
> stringClean(&strFwd);
>
> pay close attention to
>
> inet_ntoa(orig_request->client_addr) : "unknown"), ',');
>
> You can change the "unknown" value to whatever you like and it will send
> that value with the x-forwarded-for header.

As should you. 'unkown' is ONLY printed when there is no client addr. The
data you're looking for is already in the Host header, why do you need to
replicate it?
Received on Tue May 16 2006 - 15:43:12 MDT

This archive was generated by hypermail pre-2.1.9 : Thu Jun 01 2006 - 12:00:02 MDT