[Privoxy-users] user-agent based forwarding action
Fabian Keil
fk at fabiankeil.de
Sat Jun 24 13:52:05 UTC 2017
Beeblebrox <zaphod at berentweb.com> wrote:
> Hello, this should have been trivial but I'm stuck (privoxy-3.0.2).
>
> Trying to get forwarding rule based on user-agent. I have replaced the
> user-agent string in the browser with simple "Explorer SunOS" for testing
> (no filter definitions) and edited user.action file as:
>
> ###################
> # Crunch referrer
> { +crunch-client-header{Referer:} }
> /
There a hide-referrer action you might want to use instead:
https://www.privoxy.org/user-manual/actions-file.html#HIDE-REFERRER
> # Spoof accept-language and user agent
> {+hide-accept-language{en-ca} \
> +hide-user-agent{Mozilla/5.0 (X11; U; Linux; i686; en-ca; rv:1.7) KHTML (like Gecko)} }
> /
>
> {-filter{demoronizer}}
>
> # Tag every request with the User-Agent header. Client-header taggers are
> # first to be executed and can be used to control every other action.
> {+client-header-tagger{user-agent}}
> /
>
> # Tagging doesn't change action, sections with TAG patterns do
> # Use different forwarding based on user-agent
> {+forward-override{forward-socks5 192.168.0.102:2222 .} \
> +client-header-filter{hide-tor-exit-notation} }
> TAG:^User-Agent: Explorer SunOS/
> #########################
>
> But forwarding does not work correctly (this example for a country-level blocked site)
> Header: scan: Host: www.example.org
> Header: scan: User-Agent: Explorer SunOS
> Header: Tagger 'user-agent' added tag 'User-Agent: Explorer SunOS'. No action bits update necessary.
Note that your TAG pattern above requires a slash after SunOS
which your client doesn't send.
> 1. I can only get forwarding to work from global setting in the config file so what
> am I missing here? Also the "forward-override" rule above would presumably forward
> everything EXCEPT traffic from agent "Explorer SunOS", but when I reset the browsers
> user-agent I get the same result.
Probably the User-Agent after the reset wasn't matched by the
TAG pattern either.
> 2. Is it safe to use on-the-fly user-agent switcher/changer add-ons, if all requests
> go through Privoxy? I'd like to configure the rule so that only certain agents get
> "forward-override".
That should work as long as you can trust the clients to send the User-Agents
you expect them to.
Fabian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.privoxy.org/pipermail/privoxy-users/attachments/20170624/c21c1880/attachment.bin>
More information about the Privoxy-users
mailing list