[squid-users] Question about c-icap and setting X-Next-Services header to empty string

Alex Rousskov rousskov at measurement-factory.com
Tue Dec 1 16:18:07 UTC 2015

On 12/01/2015 08:58 AM, Giray Simsek wrote:

> I am trying to update the adaptation plan dynamically in the first
> service (service_a_resp) Basically, if a certain condition is met,
> then I don't want the second service (service_b_resp) to be called by
> Squid.

> icap_enable on
> icap_send_client_ip on
> icap_send_client_username on
> icap_client_username_header X-Client-Username
> icap_service service_a_resp respmod_precache bypass=on routing=on icap:// 
> icap_service service_b_resp respmod_precache bypass=on routing=on icap://

This is probably not important, but only the first service needs
routing=on. Your other ICAP service does not route requests.

> adaptation_service_chain response_chain service_a_resp service_b_resp
> adaptation_access response_chain allow all


> After reading the documentation about the icap_service option and its
> routing parameter, I got the impression that I can achieve this by
> setting X-Next-Services header to empty string in my first service
> (service_a_resp) in the adaptation chain 

That sounds correct although you are omitting a critical detail:
X-Next-Services is an ICAP response header, not an HTTP header.
Naturally, ICAP routing does not modify the HTTP message being routed.

> as below:
> ci_headers_add(req->response_header, "X-Next-Services: ");

Googling suggests that the above c-icap method is for adding HTTP
headers. You need to add an ICAP response header instead. I do not know
c-icap API, so I cannot recommend a specific method. If you do not know
how to do that either, consider asking on c-icap support forums.



More information about the squid-users mailing list