Search squid archive

Re: Fecthing Source Ip Address and Invoking a Code

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

 



On 8/09/2013 1:38 a.m., Norbert Naveen wrote:
Sorry let me elaborate this .
Squid is acting as Transparent Proxy
User A browses on HTTP say http://abc.com
When the user requests comes to SQUID .
I want to Add a additional Header
HTTP_X_PROFILE=Profile of Customer

How can I add this ? Because based on the IP address , I need to Query LDAP / RADIUS / AAA Server and Fetch the User Profile Dynamically
and add a new header with dynamic fetched value .

Hope this clarifies ..

Okay. Thank you.

You need a external_acl_type helper which recieves the %SRC parameter and returns the profile details.

In 3.4 (beta) series the annotation feature is a far better way to do it. The helper returns a custom key=value which is targeted at the headers. That key-value can be added as the header contents with add_request_header and the %{key-name}note format option.

Something like this:

  external_acl_type profile %SRC /path/to/helper
  acl profiler external profile
  http_access allow profiler
  request_header_add X-Profile %{profile}note

The helper returns this: OK profile="profile details"\n


Alternatively, you can also do it in 3.3 version where the add_request_header is present, but that version is stuck with the logging feature to return detais from the helper. Like so:
   OK log="profile details"\n

and the generic %ea token has to be used in request_header_add:
  request_header_add X-Profile %ea


NP: older versions of Squid lack even the request_header_add feature so it is not possible to do it without ICAP/eCAP adaptation.

Amos




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

  Powered by Linux