Search squid archive

Re: Hacking X-Forwarded-For

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





--On May 16, 2006 2:30:29 PM -0700 David Neudorfer <davidneudorfer@xxxxxxx> 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?

[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux