Re: [squid-users] Dynamic HTTP Header Addition

From: Norbert Naveen <norbert.naveen_at_tayana.in>
Date: Fri, 6 Sep 2013 11:17:51 +0530

Hello ,
    Thanks the below helps ,
    Want some guidelines from you . .
    What I am trying to achieve is that , When a Users starts browsing , I
need to Identify the Source IP address of the user
    Go to LDAP / RADIUS query for the IP address and find Information on the
customer for the IP address
    And add new header with the value being that Fetched dynamically ..

    Alex has stated how to include some scripts to get dynamic value .
    BUT , how do I pass the source IP address to the script so that based on
the Src IP address the scripts gets invoked ?
    Sorry for the elementary queries

Thanks

-----Original Message-----
From: Alex Rousskov
Sent: Tuesday, September 03, 2013 8:45 PM
To: squid-users_at_squid-cache.org
Subject: Re: [squid-users] Dynamic HTTP Header Addition

On 09/03/2013 04:37 AM, Norbert Naveen wrote:
> Hello ,
> There is possibility of adding a new HTTP header via
> Usage: request_header_add field-name field-value acl1 [acl2] ...
> Example: request_header_add X-Client-CA "CA=%ssl::>cert_issuer" all
>
> Wanted to know if the HTTP header value can be dynamic ?

Yes, the example you quoted already contains a dynamic header value
(HTTP client certificate issuer).

> and can
> invoke a program to fetch the Value dynamically and populate?

Yes, with recent Squids, you can dynamically set annotations and then
use %note macro to add those annotations to HTTP request headers.
Annotations can be set using an eCAP adapter, a url_rewrite_program or,
IIRC, an external ACL. Here is a sketch:

  url_rewrite_program /this/helper/replies/with OK note1=dynamicValue
  acl hasNote1 note note1
  request_header_add X-Note1 "%{note1}note" hasNote1

HTH,

Alex.
Received on Fri Sep 06 2013 - 05:48:36 MDT

This archive was generated by hypermail 2.2.0 : Fri Sep 06 2013 - 12:00:04 MDT