5

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

1
  • Did you ever figure this out? I have the same issue with squid 3.1 =/
    – Dirk
    Dec 5 '13 at 2:45
0

"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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.