[squid-users] request_header_replace User-Agent 'UA string' for certain URLs/domains/ACLs

Amos Jeffries squid3 at treenet.co.nz
Tue Sep 10 06:54:17 UTC 2019


On 10/09/19 10:28 am, Igor Rylov wrote:
> How to change User-Agent string only for certain ACLs, for example,
> If I set up an: acl acl_name dst some.url
> or: acl acl_name url_regex some\.url\/path
> or sources IPs: acl acl_name src 192.168.0.123
> 
> Then use the User-Agent replacement for the configured acl:
> 
> request_header_replace User-Agent User-Agent-String
> 
> I can only do as above, but how can I apply the request_header_replace
> to only work with a configured acl_name?


To use the *_header_replace directives you need to also have a matching
*_header_access deny line to prevent the original header(s) from being used.

Like so:

  request_header_access User-Agent deny acl_name

  request_header_replace User-Agent User-Agent-String


Amos


More information about the squid-users mailing list