How To Rebuild The Squid 2.6 Debian Package with Support For X-Forwarded-For Headers
How To Rebuild The Squid 2.6 Debian Package with Support For X-Forwarded-For HeadersVersion 1.0 This article describes how you can rebuild the Squid 2.6 package for Debian Etch with support for X-Forwarded-For headers - this feature is not enabled in the default Debian Etch Squid package. This feature is useful if you are using Squid as a reverse proxy for your web site and are using a load balancer (such as HAProxy) in front of Squid - it allows us to track the client's original IP address instead of the load balancer's IP address (which to Squid appears as the client). From the Squid documentation: Requests may pass through a chain of several other proxies before reaching us. The X-Forwarded-For header will contain a comma-separated list of the IP addresses in the chain, with the rightmost address being the most recent. If a request reaches us from a source that is allowed by this configuration item, then we consult the X-Forwarded-For header to see where that host received the request from. If the X-Forwarded-For header contains multiple addresses, and if acl_uses_indirect_client is on, then we continue backtracking until we reach an address for which we are not allowed to follow the X-Forwarded-For header, or until we reach the first address in the list. (If acl_uses_indirect_client is off, then it's impossible to backtrack through more than one level of X-Forwarded-For addresses.) The end result of this process is an IP address that we will refer to as the indirect client address. This address may be treated as the client address for access control, delay pools and logging, depending on the acl_uses_indirect_client, delay_pool_uses_indirect_client and log_uses_indirect_client options. You can use the following configuration options in squid.conf if the feature is enabled:
I do not issue any guarantee that this will work for you!
Rebuilding SquidFirst we install some compilers and development tools: apt-get install devscripts build-essential fakeroot Next we install the Squid source package... cd /usr/src ... and the dependencies for building a new Squid package: apt-get build-dep squid Then we go to the debian directory within the Squid directory... cd squid-2.6.5/debian ... and open the rules file: vi rules There you should find a section that starts as follows... # Configure the package. ... followed by Squid configuration options. Add the line --enable-follow-x-forwarded-for \ to the configuration options so that the section looks as follows:
Next go up one directory... cd .. ... and start the building process: ./configure Afterwards, go to the /usr/src directory... cd /usr/src ... and run ls -l You should find new Squid .deb packages: server1:/usr/src# ls -l Pick the squid and squid-common packages and install them as follows: dpkg -i squid_2.6.5-6etch4_i386.deb squid-common_2.6.5-6etch4_all.deb That's it - now Squid supports X-Forwarded-For headers.
Links
|
Join the discussion.
www.seamlessenterprise.com
IP Convergence
Integrate your wireless and wireline networks.
Learn how from the experts at Sprint.
www.seamlessenterprise.com
Wireless & Wireline Integration
Thoughts, strategies and solutions: join the discussion
www.seamlessenterprise.com
Unified Communications 2009
Join the Discussion. Now.
www.seamlessenterprise.com







Recent comments
22 hours 34 min ago
1 day 3 min ago
1 day 3 hours ago
1 day 6 hours ago
1 day 9 hours ago
1 day 10 hours ago
1 day 10 hours ago
1 day 11 hours ago
1 day 12 hours ago
1 day 13 hours ago