How to log effective outgoing HTTP requests made by Squid, with headers after adaptation

httphttp-headerssquid

I use Squid to modify some HTTP headers sent by clients. For testing purposes, I want to completely delete the 'User-Agent' header.

Here is my config :

request_header_access User-Agent deny all
header_replace User-Agent Timmy
logformat mylogformat %>a [%{%H:%M}tl] "%rm %ru HTTP/%rv" %>Hs "Accept:%{Accept}>ha User-Agent:%{User-Agent}>ha" {%Ss:%Sh}

I use the syntax '>ha' to log "The HTTP request headers after adaptation and redirection", as it is said here http://www.squid-cache.org/Versions/v3/3.1/cfgman/logformat.html

Unfortunately, according to my logfile access.log, the header is not modified :

x.x.x.x [19:18] "GET http://example.org/favicon.ico HTTP/1.1" 404 "Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 User-Agent:Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2" {TCP_MISS:DIRECT}` 

However, when requests are made to my Nginx server through the proxy, Nginx effectively logs correctly this header :

[06/Mar/2012:19:18:07 +0100] "GET /sites/all/modules/colorbox/styles/default/images/controls.png HTTP/1.1" 200 2104 "http://example.org/sites/default/files/css/css_zpYGaC6A9wUNMpW3IPg55mz-mMAjvhuo-SZTcX-lqFQ.css" "Timmy"

What is the right syntax to log correctly modified HTTP headers, urls rewritten, etc on squid log files ?

My squid version is 2.7.STABLE9 and it runs on a Debian SQueeze 64bits.

Thanks for your help

Best Answer

"adaptation" in the Squid documentation refers to ICAP and eCAP adaptation, which is not part of Squid-2.

Header mangling done by *_header_access and header_replace was done directly on the wire-format mime headers as they are sent by the old Squid versions. Current Squid-3 do it differently, though I'm not sure if the new way will affect the log results any better.