[squid-users] squid-users Digest, Vol 70, Issue 27

Amos Jeffries squid3 at treenet.co.nz
Sun Jun 21 13:42:48 UTC 2020


On 22/06/20 1:24 am, Monika Avalur wrote:
> Hello Amos,
> 
> Thank you so much for your reply.
> 
> So my use case is, in my application I have a switch which when turned
> ON, reads the client IP address from the header I configured in the
> application (i.e. X-Forwarded-For in Squid) and based on it some rules
> are triggered.
> 

You do not have to configure anything to *send* the XFF header. That is
the default behaviour. Config is only needed to receive it from clients,
and to manipulate it.


> If the switch is turned off, it uses proxy IP and based on it some other
> set of rules are triggered.
> 
> I want to establish this scenario using Squid proxy. But not sure
> whether Squid is sending the header.

To see what HTTP headers Squid is sending you can configure
"debug_options 11,2" and look for "HTTP server REQUEST" in cache.log



You may want to look into the standard "Forwarded" header for a better
long-term solution. <https://tools.ietf.org/html/rfc7239>

Currently that will need a bit of configuration for Squid to send, but
easily done:
  request_header_add Forwarded "for=%>a" all


Amos


More information about the squid-users mailing list