Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

share|improve this question
Did you ever figure this out? I have the same issue with squid 3.1 =/ –  Dirk Dec 5 '13 at 2:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.