Recommit to include Gerry.
[privoxy.git] / doc / text / user-manual.txt
1 Privoxy 3.0.8 User Manual
2
3 [ Copyright   2001 - 2007 by Privoxy Developers ]
4
5 $Id: user-manual.sgml,v 2.53 2008/01/19 15:03:05 hal9 Exp $
6
7 The Privoxy User Manual gives users information on how to install, configure
8 and use Privoxy.
9
10 Privoxy is a non-caching web proxy with advanced filtering capabilities for
11 enhancing privacy, modifying web page data, managing HTTP cookies, controlling
12 access, and removing ads, banners, pop-ups and other obnoxious Internet junk.
13 Privoxy has a flexible configuration and can be customized to suit individual
14 needs and tastes. Privoxy has application for both stand-alone systems and
15 multi-user networks.
16
17 Privoxy is based on Internet Junkbuster (tm).
18
19 You can find the latest version of the Privoxy User Manual at http://
20 www.privoxy.org/user-manual/. Please see the Contact section on how to contact
21 the developers.
22
23 -------------------------------------------------------------------------------
24
25 Table of Contents
26 1. Introduction
27
28     1.1. Features
29
30 2. Installation
31
32     2.1. Binary Packages
33
34         2.1.1. Red Hat and Fedora RPMs
35         2.1.2. Debian and Ubuntu
36         2.1.3. Windows
37         2.1.4. Solaris
38         2.1.5. OS/2
39         2.1.6. Mac OSX
40         2.1.7. AmigaOS
41         2.1.8. FreeBSD
42         2.1.9. Gentoo
43
44     2.2. Building from Source
45     2.3. Keeping your Installation Up-to-Date
46
47 3. What's New in this Release
48
49     3.1. Note to Upgraders
50
51 4. Quickstart to Using Privoxy
52
53     4.1. Quickstart to Ad Blocking
54
55 5. Starting Privoxy
56
57     5.1. Red Hat and Fedora
58     5.2. Debian
59     5.3. Windows
60     5.4. Solaris, NetBSD, FreeBSD, HP-UX and others
61     5.5. OS/2
62     5.6. Mac OSX
63     5.7. AmigaOS
64     5.8. Gentoo
65     5.9. Command Line Options
66
67 6. Privoxy Configuration
68
69     6.1. Controlling Privoxy with Your Web Browser
70     6.2. Configuration Files Overview
71
72 7. The Main Configuration File
73
74     7.1. Local Set-up Documentation
75
76         7.1.1. user-manual
77         7.1.2. trust-info-url
78         7.1.3. admin-address
79         7.1.4. proxy-info-url
80
81     7.2. Configuration and Log File Locations
82
83         7.2.1. confdir
84         7.2.2. templdir
85         7.2.3. logdir
86         7.2.4. actionsfile
87         7.2.5. filterfile
88         7.2.6. logfile
89         7.2.7. jarfile
90         7.2.8. trustfile
91
92     7.3. Debugging
93
94         7.3.1. debug
95         7.3.2. single-threaded
96
97     7.4. Access Control and Security
98
99         7.4.1. listen-address
100         7.4.2. toggle
101         7.4.3. enable-remote-toggle
102         7.4.4. enable-remote-http-toggle
103         7.4.5. enable-edit-actions
104         7.4.6. enforce-blocks
105         7.4.7. ACLs: permit-access and deny-access
106         7.4.8. buffer-limit
107
108     7.5. Forwarding
109
110         7.5.1. forward
111         7.5.2. forward-socks4 and forward-socks4a
112         7.5.3. Advanced Forwarding Examples
113         7.5.4. forwarded-connect-retries
114         7.5.5. accept-intercepted-requests
115         7.5.6. allow-cgi-request-crunching
116         7.5.7. split-large-forms
117
118     7.6. Windows GUI Options
119
120 8. Actions Files
121
122     8.1. Finding the Right Mix
123     8.2. How to Edit
124     8.3. How Actions are Applied to Requests
125     8.4. Patterns
126
127         8.4.1. The Domain Pattern
128         8.4.2. The Path Pattern
129         8.4.3. The Tag Pattern
130
131     8.5. Actions
132
133         8.5.1. add-header
134         8.5.2. block
135         8.5.3. client-header-filter
136         8.5.4. client-header-tagger
137         8.5.5. content-type-overwrite
138         8.5.6. crunch-client-header
139         8.5.7. crunch-if-none-match
140         8.5.8. crunch-incoming-cookies
141         8.5.9. crunch-server-header
142         8.5.10. crunch-outgoing-cookies
143         8.5.11. deanimate-gifs
144         8.5.12. downgrade-http-version
145         8.5.13. fast-redirects
146         8.5.14. filter
147         8.5.15. force-text-mode
148         8.5.16. forward-override
149         8.5.17. handle-as-empty-document
150         8.5.18. handle-as-image
151         8.5.19. hide-accept-language
152         8.5.20. hide-content-disposition
153         8.5.21. hide-if-modified-since
154         8.5.22. hide-forwarded-for-headers
155         8.5.23. hide-from-header
156         8.5.24. hide-referrer
157         8.5.25. hide-user-agent
158         8.5.26. inspect-jpegs
159         8.5.27. kill-popups
160         8.5.28. limit-connect
161         8.5.29. prevent-compression
162         8.5.30. overwrite-last-modified
163         8.5.31. redirect
164         8.5.32. send-vanilla-wafer
165         8.5.33. send-wafer
166         8.5.34. server-header-filter
167         8.5.35. server-header-tagger
168         8.5.36. session-cookies-only
169         8.5.37. set-image-blocker
170         8.5.38. treat-forbidden-connects-like-blocks
171         8.5.39. Summary
172
173     8.6. Aliases
174     8.7. Actions Files Tutorial
175
176         8.7.1. default.action
177         8.7.2. user.action
178
179 9. Filter Files
180
181     9.1. Filter File Tutorial
182     9.2. The Pre-defined Filters
183
184 10. Privoxy's Template Files
185 11. Contacting the Developers, Bug Reporting and Feature Requests
186
187     11.1. Get Support
188     11.2. Reporting Problems
189
190         11.2.1. Reporting Ads or Other Configuration Problems
191         11.2.2. Reporting Bugs
192
193     11.3. Request New Features
194     11.4. Other
195
196 12. Privoxy Copyright, License and History
197
198     12.1. License
199     12.2. History
200     12.3. Authors
201
202 13. See Also
203 14. Appendix
204
205     14.1. Regular Expressions
206     14.2. Privoxy's Internal Pages
207
208         14.2.1. Bookmarklets
209
210     14.3. Chain of Events
211     14.4. Troubleshooting: Anatomy of an Action
212
213 1. Introduction
214
215 This documentation is included with the current stable version of Privoxy,
216 v.3.0.8.
217
218 -------------------------------------------------------------------------------
219
220 1.1. Features
221
222 In addition to the core features of ad blocking and cookie management, Privoxy
223 provides many supplemental features, that give the end-user more control, more
224 privacy and more freedom:
225
226   * Can be run as an "intercepting" proxy, which obviates the need to configure
227     browsers individually.
228
229   * Sophisticated actions and filters for manipulating both server and client
230     headers.
231
232   * Can be chained with other proxies.
233
234   * Integrated browser based configuration and control utility at http://
235     config.privoxy.org/ (shortcut: http://p.p/). Browser-based tracing of rule
236     and filter effects. Remote toggling.
237
238   * Web page filtering (text replacements, removes banners based on size,
239     invisible "web-bugs", JavaScript and HTML annoyances, pop-up windows, etc.)
240
241   * Modularized configuration that allows for standard settings and user
242     settings to reside in separate files, so that installing updated actions
243     files won't overwrite individual user settings.
244
245   * Support for Perl Compatible Regular Expressions in the configuration files,
246     and a more sophisticated and flexible configuration syntax.
247
248   * Improved cookie management features (e.g. session based cookies).
249
250   * GIF de-animation.
251
252   * Bypass many click-tracking scripts (avoids script redirection).
253
254   * Multi-threaded (POSIX and native threads).
255
256   * User-customizable HTML templates for all proxy-generated pages (e.g.
257     "blocked" page).
258
259   * Auto-detection and re-reading of config file changes.
260
261   * Improved signal handling, and a true daemon mode (Unix).
262
263   * Every feature now controllable on a per-site or per-location basis,
264     configuration more powerful and versatile over-all.
265
266   * Many smaller new features added, limitations and bugs removed, and security
267     holes fixed.
268
269 -------------------------------------------------------------------------------
270
271 2. Installation
272
273 Privoxy is available both in convenient pre-compiled packages for a wide range
274 of operating systems, and as raw source code. For most users, we recommend
275 using the packages, which can be downloaded from our Privoxy Project Page.
276
277 Note: On some platforms, the installer may remove previously installed
278 versions, if found. (See below for your platform). In any case be sure to
279 backup your old configuration if it is valuable to you. See the note to
280 upgraders section below.
281
282 -------------------------------------------------------------------------------
283
284 2.1. Binary Packages
285
286 How to install the binary packages depends on your operating system:
287
288 -------------------------------------------------------------------------------
289
290 2.1.1. Red Hat and Fedora RPMs
291
292 RPMs can be installed with rpm -Uvh privoxy-3.0.8-1.rpm, and will use /etc/
293 privoxy for the location of configuration files.
294
295 Note that on Red Hat, Privoxy will not be automatically started on system boot.
296 You will need to enable that using chkconfig, ntsysv, or similar methods.
297
298 If you have problems with failed dependencies, try rebuilding the SRC RPM: rpm
299 --rebuild privoxy-3.0.8-1.src.rpm. This will use your locally installed
300 libraries and RPM version.
301
302 Also note that if you have a Junkbuster RPM installed on your system, you need
303 to remove it first, because the packages conflict. Otherwise, RPM will try to
304 remove Junkbuster automatically if found, before installing Privoxy.
305
306 -------------------------------------------------------------------------------
307
308 2.1.2. Debian and Ubuntu
309
310 DEBs can be installed with apt-get install privoxy, and will use /etc/privoxy
311 for the location of configuration files.
312
313 -------------------------------------------------------------------------------
314
315 2.1.3. Windows
316
317 Just double-click the installer, which will guide you through the installation
318 process. You will find the configuration files in the same directory as you
319 installed Privoxy in.
320
321 Version 3.0.5 beta introduced full Windows service functionality. On Windows
322 only, the Privoxy program has two new command line arguments to install and
323 uninstall Privoxy as a service.
324
325 Arguments:
326
327     --install[:service_name]
328
329     --uninstall[:service_name]
330
331 After invoking Privoxy with --install, you will need to bring up the Windows
332 service console to assign the user you want Privoxy to run under, and whether
333 or not you want it to run whenever the system starts. You can start the Windows
334 services console with the following command: services.msc. If you do not take
335 the manual step of modifying Privoxy's service settings, it will not start.
336 Note too that you will need to give Privoxy a user account that actually
337 exists, or it will not be permitted to write to its log and configuration
338 files.
339
340 -------------------------------------------------------------------------------
341
342 2.1.4. Solaris
343
344 Create a new directory, cd to it, then unzip and untar the archive. For the
345 most part, you'll have to figure out where things go.
346
347 -------------------------------------------------------------------------------
348
349 2.1.5. OS/2
350
351 First, make sure that no previous installations of Junkbuster and / or Privoxy
352 are left on your system. Check that no Junkbuster or Privoxy objects are in
353 your startup folder. 
354
355 Then, just double-click the WarpIN self-installing archive, which will guide
356 you through the installation process. A shadow of the Privoxy executable will
357 be placed in your startup folder so it will start automatically whenever OS/2
358 starts.
359
360 The directory you choose to install Privoxy into will contain all of the
361 configuration files.
362
363 -------------------------------------------------------------------------------
364
365 2.1.6. Mac OSX
366
367 Unzip the downloaded file (you can either double-click on the file from the
368 finder, or from the desktop if you downloaded it there). Then, double-click on
369 the package installer icon named Privoxy.pkg and follow the installation
370 process. Privoxy will be installed in the folder /Library/Privoxy. It will
371 start automatically whenever you start up. To prevent it from starting
372 automatically, remove or rename the folder /Library/StartupItems/Privoxy.
373
374 To start Privoxy by hand, double-click on StartPrivoxy.command in the /Library/
375 Privoxy folder. Or, type this command in the Terminal:
376
377   /Library/Privoxy/StartPrivoxy.command
378
379
380
381 You will be prompted for the administrator password.
382
383 -------------------------------------------------------------------------------
384
385 2.1.7. AmigaOS
386
387 Copy and then unpack the lha archive to a suitable location. All necessary
388 files will be installed into Privoxy directory, including all configuration and
389 log files. To uninstall, just remove this directory.
390
391 -------------------------------------------------------------------------------
392
393 2.1.8. FreeBSD
394
395 Privoxy is part of FreeBSD's Ports Collection, you can build and install it
396 with cd /usr/ports/www/privoxy; make install clean.
397
398 If you don't use the ports, you can fetch and install the package with pkg_add
399 -r privoxy.
400
401 The port skeleton and the package can also be downloaded from the File Release
402 Page, but there's no reason to use them unless you're interested in the beta
403 releases which are only available there.
404
405 -------------------------------------------------------------------------------
406
407 2.1.9. Gentoo
408
409 Gentoo source packages (Ebuilds) for Privoxy are contained in the Gentoo
410 Portage Tree (they are not on the download page, but there is a Gentoo section,
411 where you can see when a new Privoxy Version is added to the Portage Tree).
412
413 Before installing Privoxy under Gentoo just do first emerge rsync to get the
414 latest changes from the Portage tree. With emerge privoxy you install the
415 latest version.
416
417 Configuration files are in /etc/privoxy, the documentation is in /usr/share/doc
418 /privoxy-3.0.8 and the Log directory is in /var/log/privoxy.
419
420 -------------------------------------------------------------------------------
421
422 2.2. Building from Source
423
424 The most convenient way to obtain the Privoxy sources is to download the source
425 tarball from our project download page.
426
427 If you like to live on the bleeding edge and are not afraid of using possibly
428 unstable development versions, you can check out the up-to-the-minute version
429 directly from the CVS repository.
430
431 To build Privoxy from source, autoconf, GNU make (gmake), and, of course, a C
432 compiler like gcc are required.
433
434 When building from a source tarball, first unpack the source:
435
436  tar xzvf privoxy-3.0.8-src* [.tgz or .tar.gz]
437  cd privoxy-3.0.8
438
439
440 For retrieving the current CVS sources, you'll need a CVS client installed.
441 Note that sources from CVS are typically development quality, and may not be
442 stable, or well tested. To download CVS source, check the Sourceforge
443 documentation, which might give commands like:
444
445   cvs -d:pserver:anonymous@ijbswa.cvs.sourceforge.net:/cvsroot/ijbswa login
446   cvs -z3 -d:pserver:anonymous@ijbswa.cvs.sourceforge.net:/cvsroot/ijbswa co current
447   cd current
448
449
450 This will create a directory named current/, which will contain the source
451 tree.
452
453 You can also check out any Privoxy "branch", just exchange the current name
454 with the wanted branch name (Example: v_3_0_branch for the 3.0 cvs tree).
455
456 It is also strongly recommended to not run Privoxy as root. You should
457 configure/install/run Privoxy as an unprivileged user, preferably by creating a
458 "privoxy" user and group just for this purpose. See your local documentation
459 for the correct command line to do add new users and groups (something like
460 adduser, but the command syntax may vary from platform to platform).
461
462 /etc/passwd might then look like:
463
464   privoxy:*:7777:7777:privoxy proxy:/no/home:/no/shell
465
466
467 And then /etc/group, like:
468
469   privoxy:*:7777:
470
471
472 Some binary packages may do this for you.
473
474 Then, to build from either unpacked tarball or CVS source:
475
476  autoheader
477  autoconf
478  ./configure      # (--help to see options)
479  make             # (the make from GNU, sometimes called gmake)
480  su               # Possibly required
481  make -n install  # (to see where all the files will go)
482  make -s install  # (to really install, -s to silence output)
483
484
485 Using GNU make, you can have the first four steps automatically done for you by
486 just typing:
487
488   make
489
490
491 in the freshly downloaded or unpacked source directory.
492
493 To build an executable with security enhanced features so that users cannot
494 easily bypass the proxy (e.g. "Go There Anyway"), or alter their own
495 configurations, configure like this:
496
497  ./configure  --disable-toggle  --disable-editor  --disable-force
498
499
500 Then build as above. In Privoxy 3.0.7 and later, all of these options can also
501 be disabled through the configuration file.
502
503 WARNING: If installing as root, the install will fail unless a non-root user or
504 group is specified, or a privoxy user and group already exist on the system. If
505 a non-root user is specified, and no group, then the installation will try to
506 also use a group of the same name as "user". If a group is specified (and no
507 user), then the support files will be installed as writable by that group, and
508 owned by the user running the installation.
509
510 configure accepts --with-user and --with-group options for setting user and
511 group ownership of the configuration files (which need to be writable by the
512 daemon). The specified user must already exist. When starting Privoxy, it must
513 be run as this same user to insure write access to configuration and log files!
514
515 Alternately, you can specify user and group on the make command line, but be
516 sure both already exist:
517
518  make -s install  USER=privoxy GROUP=privoxy
519
520
521 The default installation path for make install is /usr/local. This may of
522 course be customized with the various ./configure path options. If you are
523 doing an install to anywhere besides /usr/local, be sure to set the appropriate
524 paths with the correct configure options (./configure --help). Non-privileged
525 users must of course have write access permissions to wherever the target
526 installation is going.
527
528 If you do install to /usr/local, the install will use sysconfdir=$prefix/etc/
529 privoxy by default. All other destinations, and the direct usage of
530 --sysconfdir flag behave like normal, i.e. will not add the extra privoxy
531 directory. This is for a safer install, as there may already exist another
532 program that uses a file with the "config" name, and thus makes /usr/local/etc
533 cleaner.
534
535 If installing to /usr/local, the documentation will go by default to $prefix/
536 share/doc. But if this directory doesn't exist, it will then try $prefix/doc
537 and install there before creating a new $prefix/share/doc just for Privoxy.
538
539 Again, if the installs goes to /usr/local, the localstatedir (ie: var/) will
540 default to /var instead of $prefix/var so the logs will go to /var/log/privoxy
541 /, and the pid file will be created in /var/run/privoxy.pid.
542
543 make install will attempt to set the correct values in config (main
544 configuration file). You should check this to make sure all values are correct.
545 If appropriate, an init script will be installed, but it is up to the user to
546 determine how and where to start Privoxy. The init script should be checked for
547 correct paths and values, if anything other than a default install is done.
548
549 If install finds previous versions of local configuration files, most of these
550 will not be overwritten, and the new ones will be installed with a "new"
551 extension. default.action, default.filter, and standard.action will be
552 overwritten. You will then need to manually update the other installed
553 configuration files as needed. The default template files will be overwritten.
554 If you have customized, local templates, these should be stored safely in a
555 separate directory and defined in config by the "templdir" directive. It is of
556 course wise to always back-up any important configuration files "just in case".
557 If a previous version of Privoxy is already running, you will have to restart
558 it manually.
559
560 For more detailed instructions on how to build Redhat RPMs, Windows
561 self-extracting installers, building on platforms with special requirements
562 etc, please consult the developer manual.
563
564 -------------------------------------------------------------------------------
565
566 2.3. Keeping your Installation Up-to-Date
567
568 As user feedback comes in and development continues, we will make updated
569 versions of both the main actions file (as a separate package) and the software
570 itself (including the actions file) available for download.
571
572 If you wish to receive an email notification whenever we release updates of
573 Privoxy or the actions file, subscribe to our announce mailing list,
574 ijbswa-announce@lists.sourceforge.net.
575
576 In order not to lose your personal changes and adjustments when updating to the
577 latest default.action file we strongly recommend that you use user.action and
578 user.filter for your local customizations of Privoxy. See the Chapter on
579 actions files for details.
580
581 -------------------------------------------------------------------------------
582
583 3. What's New in this Release
584
585 There are many improvements and new features since Privoxy 3.0.6, the last
586 stable release:
587
588   * Two new actions server-header-tagger and client-header-tagger that can be
589     used to create arbitrary "tags" based on client and server headers. These
590     "tags" can then subsequently be used to control the other actions used for
591     the current request, greatly increasing Privoxy's flexibility and
592     selectivity. See tag patterns for more information on tags.
593
594   * Header filtering is done with dedicated header filters now. As a result the
595     actions "filter-client-headers" and "filter-server-headers" that were
596     introduced with Privoxy 3.0.5 to apply content filters to the headers have
597     been removed. See the new actions server-header-filter and
598     client-header-filter for details.
599
600   * There are four new options for the main config file:
601
602       + allow-cgi-request-crunching which allows requests for Privoxy's
603         internal CGI pages to be blocked, redirected or (un)trusted like
604         ordinary requests.
605
606       + split-large-forms that will work around a browser bug that caused IE6
607         and IE7 to ignore the Submit button on the Privoxy's
608         edit-actions-for-url CGI page.
609
610       + accept-intercepted-requests which allows to combine Privoxy with any
611         packet filter to create an intercepting proxy for HTTP/1.1 requests
612         (and for HTTP/1.0 requests with Host header set). This means clients
613         can be forced to use Privoxy even if their proxy settings are
614         configured differently.
615
616       + templdir to designate an alternate location for Privoxy's locally
617         customized CGI templates so that these are not overwritten during
618         upgrades.
619
620   * A new command line option --pre-chroot-nslookup hostname to initialize the
621     resolver library before chroot'ing. On some systems this reduces the number
622     of files that must be copied into the chroot tree. (Patch provided by
623     Stephen Gildea)
624
625   * The forward-override action allows changing of the forwarding settings
626     through the actions files. Combined with tags, this allows to choose the
627     forwarder based on client headers like the User-Agent, or the request
628     origin.
629
630   * The redirect action can now use regular expression substitutions against
631     the original URL.
632
633   * zlib support is now available as a compile time option to filter compressed
634     content. Patch provided by Wil Mahan.
635
636   * Improve various filters, and add new ones.
637
638   * Include support for RFC 3253 so that Subversion works with Privoxy. Patch
639     provided by Petr Kadlec.
640
641   * Logging can be completely turned off by not specifying a logfile directive.
642
643   * A number of improvements to Privoxy's internal CGI pages, including the use
644     of favicons for error and control pages.
645
646   * Many bugfixes, memory leaks addressed, code improvements, and logging
647     improvements.
648
649 For a more detailed list of changes please have a look at the ChangeLog.
650
651 -------------------------------------------------------------------------------
652
653 3.1. Note to Upgraders
654
655 A quick list of things to be aware of before upgrading from earlier versions of
656 Privoxy:
657
658   * The recommended way to upgrade Privoxy is to backup your old configuration
659     files, install the new ones, verify that Privoxy is working correctly and
660     finally merge back your changes using diff and maybe patch.
661
662     There are a number of new features in each Privoxy release and most of them
663     have to be explicitly enabled in the configuration files. Old configuration
664     files obviously don't do that and due to syntax changes using old
665     configuration files with a new Privoxy isn't always possible anyway.
666
667   * Note that some installers remove earlier versions completely, including
668     configuration files, therefore you should really save any important
669     configuration files!
670
671   * On the other hand, other installers don't overwrite existing configuration
672     files, thinking you will want to do that yourself.
673
674   * standard.action now only includes the enabled actions. Not all actions as
675     before.
676
677   * In the default configuration only fatal errors are logged now. You can
678     change that in the debug section of the configuration file. You may also
679     want to enable more verbose logging until you verified that the new Privoxy
680     version is working as expected.
681
682   * Three other config file settings are now off by default:
683     enable-remote-toggle, enable-remote-http-toggle, and enable-edit-actions.
684     If you use or want these, you will need to explicitly enable them, and be
685     aware of the security issues involved.
686
687   * The "filter-client-headers" and "filter-server-headers" actions that were
688     introduced with Privoxy 3.0.5 to apply content filters to the headers have
689     been removed and replaced with new actions. See the What's New section
690     above.
691
692 -------------------------------------------------------------------------------
693
694 4. Quickstart to Using Privoxy
695
696   * Install Privoxy. See the Installation Section below for platform specific
697     information.
698
699   * Advanced users and those who want to offer Privoxy service to more than
700     just their local machine should check the main config file, especially the
701     security-relevant options. These are off by default.
702
703   * Start Privoxy, if the installation program has not done this already (may
704     vary according to platform). See the section Starting Privoxy.
705
706   * Set your browser to use Privoxy as HTTP and HTTPS (SSL) proxy by setting
707     the proxy configuration for address of 127.0.0.1 and port 8118. DO NOT
708     activate proxying for FTP or any protocols besides HTTP and HTTPS (SSL)
709     unless you intend to prevent your browser from using these protocols.
710
711   * Flush your browser's disk and memory caches, to remove any cached ad
712     images. If using Privoxy to manage cookies, you should remove any currently
713     stored cookies too.
714
715   * A default installation should provide a reasonable starting point for most.
716     There will undoubtedly be occasions where you will want to adjust the
717     configuration, but that can be dealt with as the need arises. Little to no
718     initial configuration is required in most cases, you may want to enable the
719     web-based action editor though. Be sure to read the warnings first.
720
721     See the Configuration section for more configuration options, and how to
722     customize your installation. You might also want to look at the next
723     section for a quick introduction to how Privoxy blocks ads and banners.
724
725   * If you experience ads that slip through, innocent images that are blocked,
726     or otherwise feel the need to fine-tune Privoxy's behavior, take a look at
727     the actions files. As a quick start, you might find the richly commented
728     examples helpful. You can also view and edit the actions files through the
729     web-based user interface. The Appendix "Troubleshooting: Anatomy of an
730     Action" has hints on how to understand and debug actions that "misbehave".
731
732   * Please see the section Contacting the Developers on how to report bugs,
733     problems with websites or to get help.
734
735   * Now enjoy surfing with enhanced control, comfort and privacy!
736
737 -------------------------------------------------------------------------------
738
739 4.1. Quickstart to Ad Blocking
740
741 Ad blocking is but one of Privoxy's array of features. Many of these features
742 are for the technically minded advanced user. But, ad and banner blocking is
743 surely common ground for everybody.
744
745 This section will provide a quick summary of ad blocking so you can get up to
746 speed quickly without having to read the more extensive information provided
747 below, though this is highly recommended.
748
749 First a bit of a warning ... blocking ads is much like blocking SPAM: the more
750 aggressive you are about it, the more likely you are to block things that were
751 not intended. And the more likely that some things may not work as intended. So
752 there is a trade off here. If you want extreme ad free browsing, be prepared to
753 deal with more "problem" sites, and to spend more time adjusting the
754 configuration to solve these unintended consequences. In short, there is not an
755 easy way to eliminate all ads. Either take the easy way and settle for most ads
756 blocked with the default configuration, or jump in and tweak it for your
757 personal surfing habits and preferences.
758
759 Secondly, a brief explanation of Privoxy's "actions". "Actions" in this
760 context, are the directives we use to tell Privoxy to perform some task
761 relating to HTTP transactions (i.e. web browsing). We tell Privoxy to take some
762 "action". Each action has a unique name and function. While there are many
763 potential actions in Privoxy's arsenal, only a few are used for ad blocking.
764 Actions, and action configuration files, are explained in depth below.
765
766 Actions are specified in Privoxy's configuration, followed by one or more URLs
767 to which the action should apply. URLs can actually be URL type patterns that
768 use wildcards so they can apply potentially to a range of similar URLs. The
769 actions, together with the URL patterns are called a section.
770
771 When you connect to a website, the full URL will either match one or more of
772 the sections as defined in Privoxy's configuration, or not. If so, then Privoxy
773 will perform the respective actions. If not, then nothing special happens.
774 Furthermore, web pages may contain embedded, secondary URLs that your web
775 browser will use to load additional components of the page, as it parses the
776 original page's HTML content. An ad image for instance, is just an URL embedded
777 in the page somewhere. The image itself may be on the same server, or a server
778 somewhere else on the Internet. Complex web pages will have many such embedded
779 URLs. Privoxy can deal with each URL individually, so, for instance, the main
780 page text is not touched, but images from such-and-such server are blocked.
781
782 The most important actions for basic ad blocking are: block, handle-as-image,
783 handle-as-empty-document,and set-image-blocker:
784
785   * block - this is perhaps the single most used action, and is particularly
786     important for ad blocking. This action stops any contact between your
787     browser and any URL patterns that match this action's configuration. It can
788     be used for blocking ads, but also anything that is determined to be
789     unwanted. By itself, it simply stops any communication with the remote
790     server and sends Privoxy's own built-in BLOCKED page instead to let you now
791     what has happened (with some exceptions, see below).
792
793   * handle-as-image - tells Privoxy to treat this URL as an image. Privoxy's
794     default configuration already does this for all common image types (e.g.
795     GIF), but there are many situations where this is not so easy to determine.
796     So we'll force it in these cases. This is particularly important for ad
797     blocking, since only if we know that it's an image of some kind, can we
798     replace it with an image of our choosing, instead of the Privoxy BLOCKED
799     page (which would only result in a "broken image" icon). There are some
800     limitations to this though. For instance, you can't just brute-force an
801     image substitution for an entire HTML page in most situations.
802
803   * handle-as-empty-document - sends an empty document instead of Privoxy's
804     normal BLOCKED HTML page. This is useful for file types that are neither
805     HTML nor images, such as blocking JavaScript files.
806
807   * set-image-blocker - tells Privoxy what to display in place of an ad image
808     that has hit a block rule. For this to come into play, the URL must match a
809     block action somewhere in the configuration, and, it must also match an
810     handle-as-image action.
811
812     The configuration options on what to display instead of the ad are:
813
814        pattern - a checkerboard pattern, so that an ad replacement is obvious.
815     This is the default.
816
817        blank - A very small empty GIF image is displayed. This is the so-called
818     "invisible" configuration option.
819
820        http://<URL> - A redirect to any image anywhere of the user's choosing
821     (advanced usage).
822
823 Advanced users will eventually want to explore Privoxy filters as well. Filters
824 are very different from blocks. A "block" blocks a site, page, or unwanted
825 contented. Filters are a way of filtering or modifying what is actually on the
826 page. An example filter usage: a text replacement of "no-no" for "nasty-word".
827 That is a very simple example. This process can be used for ad blocking, but it
828 is more in the realm of advanced usage and has some pitfalls to be wary off.
829
830 The quickest way to adjust any of these settings is with your browser through
831 the special Privoxy editor at http://config.privoxy.org/show-status (shortcut:
832 http://p.p/show-status). This is an internal page, and does not require
833 Internet access.
834
835 Note that as of Privoxy 3.0.7 beta the action editor is disabled by default.
836 Check the enable-edit-actions section in the configuration file to learn why
837 and in which cases it's safe to enable again.
838
839 If you decided to enable the action editor, select the appropriate "actions"
840 file, and click "Edit". It is best to put personal or local preferences in
841 user.action since this is not meant to be overwritten during upgrades, and will
842 over-ride the settings in other files. Here you can insert new "actions", and
843 URLs for ad blocking or other purposes, and make other adjustments to the
844 configuration. Privoxy will detect these changes automatically.
845
846 A quick and simple step by step example:
847
848   * Right click on the ad image to be blocked, then select "Copy Link Location"
849     from the pop-up menu.
850
851   * Set your browser to http://config.privoxy.org/show-status
852
853   * Find user.action in the top section, and click on "Edit":
854
855     Figure 1. Actions Files in Use
856
857     [files-in-u]
858
859   * You should have a section with only block listed under "Actions:". If not,
860     click a "Insert new section below" button, and in the new section that just
861     appeared, click the Edit button right under the word "Actions:". This will
862     bring up a list of all actions. Find block near the top, and click in the
863     "Enabled" column, then "Submit" just below the list.
864
865   * Now, in the block actions section, click the "Add" button, and paste the
866     URL the browser got from "Copy Link Location". Remove the http:// at the
867     beginning of the URL. Then, click "Submit" (or "OK" if in a pop-up window).
868
869   * Now go back to the original page, and press SHIFT-Reload (or flush all
870     browser caches). The image should be gone now.
871
872 This is a very crude and simple example. There might be good reasons to use a
873 wildcard pattern match to include potentially similar images from the same
874 site. For a more extensive explanation of "patterns", and the entire actions
875 concept, see the Actions section.
876
877 For advanced users who want to hand edit their config files, you might want to
878 now go to the Actions Files Tutorial. The ideas explained therein also apply to
879 the web-based editor.
880
881 There are also various filters that can be used for ad blocking (filters are a
882 special subset of actions). These fall into the "advanced" usage category, and
883 are explained in depth in later sections.
884
885 -------------------------------------------------------------------------------
886
887 5. Starting Privoxy
888
889 Before launching Privoxy for the first time, you will want to configure your
890 browser(s) to use Privoxy as a HTTP and HTTPS (SSL) proxy. The default is
891 127.0.0.1 (or localhost) for the proxy address, and port 8118 (earlier versions
892 used port 8000). This is the one configuration step that must be done!
893
894 Please note that Privoxy can only proxy HTTP and HTTPS traffic. It will not
895 work with FTP or other protocols.
896
897 Figure 2. Proxy Configuration Showing Mozilla/Netscape HTTP and HTTPS (SSL)
898 Settings
899
900 [proxy_setu]
901
902 With Firefox, this is typically set under:
903
904  Tools -> Options -> General -> Connection Settings -> Manual Proxy
905 Configuration
906  
907
908 Or optionally on some platforms:
909
910  Edit -> Preferences -> General -> Connection Settings -> Manual Proxy
911 Configuration
912  
913
914 With Netscape (and Mozilla), this can be set under:
915
916  Edit -> Preferences -> Advanced -> Proxies -> HTTP Proxy
917  
918
919 For Internet Explorer v.5-6:
920
921  Tools -> Internet Options -> Connections -> LAN Settings
922
923 Then, check "Use Proxy" and fill in the appropriate info (Address: 127.0.0.1,
924 Port: 8118). Include HTTPS (SSL), if you want HTTPS proxy support too
925 (sometimes labeled "Secure"). Make sure any checkboxes like "Use the same proxy
926 server for all protocols" is UNCHECKED. You want only HTTP and HTTPS (SSL)!
927
928 Figure 3. Proxy Configuration Showing Internet Explorer HTTP and HTTPS (Secure)
929 Settings
930
931 [proxy2]
932
933 After doing this, flush your browser's disk and memory caches to force a
934 re-reading of all pages and to get rid of any ads that may be cached. Remove
935 any cookies, if you want Privoxy to manage that. You are now ready to start
936 enjoying the benefits of using Privoxy!
937
938 Privoxy itself is typically started by specifying the main configuration file
939 to be used on the command line. If no configuration file is specified on the
940 command line, Privoxy will look for a file named config in the current
941 directory. Except on Win32 where it will try config.txt.
942
943 -------------------------------------------------------------------------------
944
945 5.1. Red Hat and Fedora
946
947 A default Red Hat installation may not start Privoxy upon boot. It will use the
948 file /etc/privoxy/config as its main configuration file.
949
950  # /etc/rc.d/init.d/privoxy start
951
952
953 Or ...
954
955  # service privoxy start
956
957
958 -------------------------------------------------------------------------------
959
960 5.2. Debian
961
962 We use a script. Note that Debian typically starts Privoxy upon booting per
963 default. It will use the file /etc/privoxy/config as its main configuration
964 file.
965
966  # /etc/init.d/privoxy start
967
968
969 -------------------------------------------------------------------------------
970
971 5.3. Windows
972
973 Click on the Privoxy Icon to start Privoxy. If no configuration file is
974 specified on the command line, Privoxy will look for a file named config.txt.
975 Note that Windows will automatically start Privoxy when the system starts if
976 you chose that option when installing.
977
978 Privoxy can run with full Windows service functionality. On Windows only, the
979 Privoxy program has two new command line arguments to install and uninstall
980 Privoxy as a service. See the Windows Installation instructions for details.
981
982 -------------------------------------------------------------------------------
983
984 5.4. Solaris, NetBSD, FreeBSD, HP-UX and others
985
986 Example Unix startup command:
987
988  # /usr/sbin/privoxy /etc/privoxy/config
989
990
991 -------------------------------------------------------------------------------
992
993 5.5. OS/2
994
995 During installation, Privoxy is configured to start automatically when the
996 system restarts. You can start it manually by double-clicking on the Privoxy
997 icon in the Privoxy folder.
998
999 -------------------------------------------------------------------------------
1000
1001 5.6. Mac OSX
1002
1003 During installation, Privoxy is configured to start automatically when the
1004 system restarts. To start Privoxy manually, double-click on the
1005 StartPrivoxy.command icon in the /Library/Privoxy folder. Or, type this command
1006 in the Terminal:
1007
1008   /Library/Privoxy/StartPrivoxy.command
1009
1010
1011
1012 You will be prompted for the administrator password.
1013
1014 -------------------------------------------------------------------------------
1015
1016 5.7. AmigaOS
1017
1018 Start Privoxy (with RUN <>NIL:) in your startnet script (AmiTCP), in
1019 s:user-startup (RoadShow), as startup program in your startup script (Genesis),
1020 or as startup action (Miami and MiamiDx). Privoxy will automatically quit when
1021 you quit your TCP/IP stack (just ignore the harmless warning your TCP/IP stack
1022 may display that Privoxy is still running).
1023
1024 -------------------------------------------------------------------------------
1025
1026 5.8. Gentoo
1027
1028 A script is again used. It will use the file /etc/privoxy/config as its main
1029 configuration file.
1030
1031  /etc/init.d/privoxy start
1032
1033
1034
1035 Note that Privoxy is not automatically started at boot time by default. You can
1036 change this with the rc-update command.
1037
1038  rc-update add privoxy default
1039
1040
1041
1042 -------------------------------------------------------------------------------
1043
1044 5.9. Command Line Options
1045
1046 Privoxy may be invoked with the following command-line options:
1047
1048   * --version
1049
1050     Print version info and exit. Unix only.
1051
1052   * --help
1053
1054     Print short usage info and exit. Unix only.
1055
1056   * --no-daemon
1057
1058     Don't become a daemon, i.e. don't fork and become process group leader, and
1059     don't detach from controlling tty. Unix only.
1060
1061   * --pidfile FILE
1062
1063     On startup, write the process ID to FILE. Delete the FILE on exit. Failure
1064     to create or delete the FILE is non-fatal. If no FILE option is given, no
1065     PID file will be used. Unix only.
1066
1067   * --user USER[.GROUP]
1068
1069     After (optionally) writing the PID file, assume the user ID of USER, and if
1070     included the GID of GROUP. Exit if the privileges are not sufficient to do
1071     so. Unix only.
1072
1073   * --chroot
1074
1075     Before changing to the user ID given in the --user option, chroot to that
1076     user's home directory, i.e. make the kernel pretend to the Privoxy process
1077     that the directory tree starts there. If set up carefully, this can limit
1078     the impact of possible vulnerabilities in Privoxy to the files contained in
1079     that hierarchy. Unix only.
1080
1081   * --pre-chroot-nslookup hostname
1082
1083     Specifies a hostname to look up before doing a chroot. On some systems,
1084     initializing the resolver library involves reading config files from /etc
1085     and/or loading additional shared libraries from /lib. On these systems,
1086     doing a hostname lookup before the chroot reduces the number of files that
1087     must be copied into the chroot tree.
1088
1089     For fastest startup speed, a good value is a hostname that is not in /etc/
1090     hosts but that your local name server (listed in /etc/resolv.conf) can
1091     resolve without recursion (that is, without having to ask any other name
1092     servers). The hostname need not exist, but if it doesn't, an error message
1093     (which can be ignored) will be output.
1094
1095   * configfile
1096
1097     If no configfile is included on the command line, Privoxy will look for a
1098     file named "config" in the current directory (except on Win32 where it will
1099     look for "config.txt" instead). Specify full path to avoid confusion. If no
1100     config file is found, Privoxy will fail to start.
1101
1102 On MS Windows only there are two additional command-line options to allow
1103 Privoxy to install and run as a service. See the Window Installation section
1104 for details.
1105
1106 -------------------------------------------------------------------------------
1107
1108 6. Privoxy Configuration
1109
1110 All Privoxy configuration is stored in text files. These files can be edited
1111 with a text editor. Many important aspects of Privoxy can also be controlled
1112 easily with a web browser.
1113
1114 -------------------------------------------------------------------------------
1115
1116 6.1. Controlling Privoxy with Your Web Browser
1117
1118 Privoxy's user interface can be reached through the special URL http://
1119 config.privoxy.org/ (shortcut: http://p.p/), which is a built-in page and works
1120 without Internet access. You will see the following section: 
1121
1122      Privoxy Menu
1123         ?  View & change the current configuration
1124         ?  View the source code version numbers
1125         ?  View the request headers.
1126         ?  Look up which actions apply to a URL and why
1127         ?  Toggle Privoxy on or off
1128         ?  Documentation
1129
1130
1131 This should be self-explanatory. Note the first item leads to an editor for the
1132 actions files, which is where the ad, banner, cookie, and URL blocking magic is
1133 configured as well as other advanced features of Privoxy. This is an easy way
1134 to adjust various aspects of Privoxy configuration. The actions file, and other
1135 configuration files, are explained in detail below.
1136
1137 "Toggle Privoxy On or Off" is handy for sites that might have problems with
1138 your current actions and filters. You can in fact use it as a test to see
1139 whether it is Privoxy causing the problem or not. Privoxy continues to run as a
1140 proxy in this case, but all manipulation is disabled, i.e. Privoxy acts like a
1141 normal forwarding proxy. There is even a toggle Bookmarklet offered, so that
1142 you can toggle Privoxy with one click from your browser.
1143
1144 Note that several of the features described above are disabled by default in
1145 Privoxy 3.0.7 beta and later. Check the configuration file to learn why and in
1146 which cases it's safe to enable them again.
1147
1148 -------------------------------------------------------------------------------
1149
1150 6.2. Configuration Files Overview
1151
1152 For Unix, *BSD and Linux, all configuration files are located in /etc/privoxy/
1153 by default. For MS Windows, OS/2, and AmigaOS these are all in the same
1154 directory as the Privoxy executable.
1155
1156 The installed defaults provide a reasonable starting point, though some
1157 settings may be aggressive by some standards. For the time being, the principle
1158 configuration files are:
1159
1160   * The main configuration file is named config on Linux, Unix, BSD, OS/2, and
1161     AmigaOS and config.txt on Windows. This is a required file.
1162
1163   * default.action (the main actions file) is used to define which "actions"
1164     relating to banner-blocking, images, pop-ups, content modification, cookie
1165     handling etc should be applied by default. It also defines many exceptions
1166     (both positive and negative) from this default set of actions that enable
1167     Privoxy to selectively eliminate the junk, and only the junk, on as many
1168     websites as possible.
1169
1170     Multiple actions files may be defined in config. These are processed in the
1171     order they are defined. Local customizations and locally preferred
1172     exceptions to the default policies as defined in default.action (which you
1173     will most probably want to define sooner or later) are probably best
1174     applied in user.action, where you can preserve them across upgrades.
1175     standard.action is only for Privoxy's internal use.
1176
1177     There is also a web based editor that can be accessed from http://
1178     config.privoxy.org/show-status (Shortcut: http://p.p/show-status) for the
1179     various actions files.
1180
1181   * "Filter files" (the filter file) can be used to re-write the raw page
1182     content, including viewable text as well as embedded HTML and JavaScript,
1183     and whatever else lurks on any given web page. The filtering jobs are only
1184     pre-defined here; whether to apply them or not is up to the actions files.
1185     default.filter includes various filters made available for use by the
1186     developers. Some are much more intrusive than others, and all should be
1187     used with caution. You may define additional filter files in config as you
1188     can with actions files. We suggest user.filter for any locally defined
1189     filters or customizations.
1190
1191 The syntax of the configuration and filter files may change between different
1192 Privoxy versions, unfortunately some enhancements cost backwards compatibility.
1193
1194 All files use the "#" character to denote a comment (the rest of the line will
1195 be ignored) and understand line continuation through placing a backslash ("\")
1196 as the very last character in a line. If the # is preceded by a backslash, it
1197 looses its special function. Placing a # in front of an otherwise valid
1198 configuration line to prevent it from being interpreted is called "commenting
1199 out" that line. Blank lines are ignored.
1200
1201 The actions files and filter files can use Perl style regular expressions for
1202 maximum flexibility.
1203
1204 After making any changes, there is no need to restart Privoxy in order for the
1205 changes to take effect. Privoxy detects such changes automatically. Note,
1206 however, that it may take one or two additional requests for the change to take
1207 effect. When changing the listening address of Privoxy, these "wake up"
1208 requests must obviously be sent to the old listening address.
1209
1210 -------------------------------------------------------------------------------
1211
1212 7. The Main Configuration File
1213
1214 Again, the main configuration file is named config on Linux/Unix/BSD and OS/2,
1215 and config.txt on Windows. Configuration lines consist of an initial keyword
1216 followed by a list of values, all separated by whitespace (any number of spaces
1217 or tabs). For example:
1218
1219   confdir /etc/privoxy
1220
1221 Assigns the value /etc/privoxy to the option confdir and thus indicates that
1222 the configuration directory is named "/etc/privoxy/".
1223
1224 All options in the config file except for confdir and logdir are optional.
1225 Watch out in the below description for what happens if you leave them unset.
1226
1227 The main config file controls all aspects of Privoxy's operation that are not
1228 location dependent (i.e. they apply universally, no matter where you may be
1229 surfing).
1230
1231 -------------------------------------------------------------------------------
1232
1233 7.1. Local Set-up Documentation
1234
1235 If you intend to operate Privoxy for more users than just yourself, it might be
1236 a good idea to let them know how to reach you, what you block and why you do
1237 that, your policies, etc.
1238
1239 -------------------------------------------------------------------------------
1240
1241 7.1.1. user-manual
1242
1243 Specifies:
1244
1245     Location of the Privoxy User Manual.
1246
1247 Type of value:
1248
1249     A fully qualified URI
1250
1251 Default value:
1252
1253     Unset
1254
1255 Effect if unset:
1256
1257     http://www.privoxy.org/version/user-manual/ will be used, where version is
1258     the Privoxy version.
1259
1260 Notes:
1261
1262     The User Manual URI is the single best source of information on Privoxy,
1263     and is used for help links from some of the internal CGI pages. The manual
1264     itself is normally packaged with the binary distributions, so you probably
1265     want to set this to a locally installed copy.
1266
1267     Examples:
1268
1269     The best all purpose solution is simply to put the full local PATH to where
1270     the User Manual is located:
1271
1272       user-manual  /usr/share/doc/privoxy/user-manual
1273
1274
1275     The User Manual is then available to anyone with access to Privoxy, by
1276     following the built-in URL: http://config.privoxy.org/user-manual/ (or the
1277     shortcut: http://p.p/user-manual/).
1278
1279     If the documentation is not on the local system, it can be accessed from a
1280     remote server, as:
1281
1282       user-manual  http://example.com/privoxy/user-manual/
1283
1284
1285     +-----------------------------------------------------------------+
1286     |                             Warning                             |
1287     |-----------------------------------------------------------------|
1288     |If set, this option should be the first option in the config     |
1289     |file, because it is used while the config file is being read on  |
1290     |start-up.                                                        |
1291     +-----------------------------------------------------------------+
1292
1293 -------------------------------------------------------------------------------
1294
1295 7.1.2. trust-info-url
1296
1297 Specifies:
1298
1299     A URL to be displayed in the error page that users will see if access to an
1300     untrusted page is denied.
1301
1302 Type of value:
1303
1304     URL
1305
1306 Default value:
1307
1308     Two example URLs are provided
1309
1310 Effect if unset:
1311
1312     No links are displayed on the "untrusted" error page.
1313
1314 Notes:
1315
1316     The value of this option only matters if the experimental trust mechanism
1317     has been activated. (See trustfile below.)
1318
1319     If you use the trust mechanism, it is a good idea to write up some on-line
1320     documentation about your trust policy and to specify the URL(s) here. Use
1321     multiple times for multiple URLs.
1322
1323     The URL(s) should be added to the trustfile as well, so users don't end up
1324     locked out from the information on why they were locked out in the first
1325     place!
1326
1327 -------------------------------------------------------------------------------
1328
1329 7.1.3. admin-address
1330
1331 Specifies:
1332
1333     An email address to reach the Privoxy administrator.
1334
1335 Type of value:
1336
1337     Email address
1338
1339 Default value:
1340
1341     Unset
1342
1343 Effect if unset:
1344
1345     No email address is displayed on error pages and the CGI user interface.
1346
1347 Notes:
1348
1349     If both admin-address and proxy-info-url are unset, the whole "Local
1350     Privoxy Support" box on all generated pages will not be shown.
1351
1352 -------------------------------------------------------------------------------
1353
1354 7.1.4. proxy-info-url
1355
1356 Specifies:
1357
1358     A URL to documentation about the local Privoxy setup, configuration or
1359     policies.
1360
1361 Type of value:
1362
1363     URL
1364
1365 Default value:
1366
1367     Unset
1368
1369 Effect if unset:
1370
1371     No link to local documentation is displayed on error pages and the CGI user
1372     interface.
1373
1374 Notes:
1375
1376     If both admin-address and proxy-info-url are unset, the whole "Local
1377     Privoxy Support" box on all generated pages will not be shown.
1378
1379     This URL shouldn't be blocked ;-)
1380
1381 -------------------------------------------------------------------------------
1382
1383 7.2. Configuration and Log File Locations
1384
1385 Privoxy can (and normally does) use a number of other files for additional
1386 configuration, help and logging. This section of the configuration file tells
1387 Privoxy where to find those other files.
1388
1389 The user running Privoxy, must have read permission for all configuration
1390 files, and write permission to any files that would be modified, such as log
1391 files and actions files.
1392
1393 -------------------------------------------------------------------------------
1394
1395 7.2.1. confdir
1396
1397 Specifies:
1398
1399     The directory where the other configuration files are located.
1400
1401 Type of value:
1402
1403     Path name
1404
1405 Default value:
1406
1407     /etc/privoxy (Unix) or Privoxy installation dir (Windows)
1408
1409 Effect if unset:
1410
1411     Mandatory
1412
1413 Notes:
1414
1415     No trailing "/", please.
1416
1417 -------------------------------------------------------------------------------
1418
1419 7.2.2. templdir
1420
1421 Specifies:
1422
1423     An alternative directory where the templates are loaded from.
1424
1425 Type of value:
1426
1427     Path name
1428
1429 Default value:
1430
1431     unset
1432
1433 Effect if unset:
1434
1435     The templates are assumed to be located in confdir/template.
1436
1437 Notes:
1438
1439     Privoxy's original templates are usually overwritten with each update. Use
1440     this option to relocate customized templates that should be kept. As
1441     template variables might change between updates, you shouldn't expect
1442     templates to work with Privoxy releases other than the one they were part
1443     of, though.
1444
1445 -------------------------------------------------------------------------------
1446
1447 7.2.3. logdir
1448
1449 Specifies:
1450
1451     The directory where all logging takes place (i.e. where logfile and jarfile
1452     are located).
1453
1454 Type of value:
1455
1456     Path name
1457
1458 Default value:
1459
1460     /var/log/privoxy (Unix) or Privoxy installation dir (Windows)
1461
1462 Effect if unset:
1463
1464     Mandatory
1465
1466 Notes:
1467
1468     No trailing "/", please.
1469
1470 -------------------------------------------------------------------------------
1471
1472 7.2.4. actionsfile
1473
1474 Specifies:
1475
1476     The actions file(s) to use
1477
1478 Type of value:
1479
1480     Complete file name, relative to confdir
1481
1482 Default values:
1483
1484       standard.action     # Internal purposes, no editing recommended
1485
1486       default.action      # Main actions file
1487
1488       user.action         # User customizations
1489
1490 Effect if unset:
1491
1492     No actions are taken at all. More or less neutral proxying.
1493
1494 Notes:
1495
1496     Multiple actionsfile lines are permitted, and are in fact recommended!
1497
1498     The default values include standard.action, which is used for internal
1499     purposes and should be loaded, default.action, which is the "main" actions
1500     file maintained by the developers, and user.action, where you can make your
1501     personal additions.
1502
1503     Actions files contain all the per site and per URL configuration for ad
1504     blocking, cookie management, privacy considerations, etc. There is no point
1505     in using Privoxy without at least one actions file.
1506
1507     Note that since Privoxy 3.0.7, the complete filename, including the
1508     ".action" extension has to be specified. The syntax change was necessary to
1509     be consistent with the other file options and to allow previously forbidden
1510     characters.
1511
1512 -------------------------------------------------------------------------------
1513
1514 7.2.5. filterfile
1515
1516 Specifies:
1517
1518     The filter file(s) to use
1519
1520 Type of value:
1521
1522     File name, relative to confdir
1523
1524 Default value:
1525
1526     default.filter (Unix) or default.filter.txt (Windows)
1527
1528 Effect if unset:
1529
1530     No textual content filtering takes place, i.e. all +filter{name} actions in
1531     the actions files are turned neutral.
1532
1533 Notes:
1534
1535     Multiple filterfile lines are permitted.
1536
1537     The filter files contain content modification rules that use regular
1538     expressions. These rules permit powerful changes on the content of Web
1539     pages, and optionally the headers as well, e.g., you could try to disable
1540     your favorite JavaScript annoyances, re-write the actual displayed text, or
1541     just have some fun playing buzzword bingo with web pages.
1542
1543     The +filter{name} actions rely on the relevant filter (name) to be defined
1544     in a filter file!
1545
1546     A pre-defined filter file called default.filter that contains a number of
1547     useful filters for common problems is included in the distribution. See the
1548     section on the filter action for a list.
1549
1550     It is recommended to place any locally adapted filters into a separate
1551     file, such as user.filter.
1552
1553 -------------------------------------------------------------------------------
1554
1555 7.2.6. logfile
1556
1557 Specifies:
1558
1559     The log file to use
1560
1561 Type of value:
1562
1563     File name, relative to logdir
1564
1565 Default value:
1566
1567     Unset (commented out). When activated: logfile (Unix) or privoxy.log
1568     (Windows).
1569
1570 Effect if unset:
1571
1572     No logfile is written.
1573
1574 Notes:
1575
1576     The logfile is where all logging and error messages are written. The level
1577     of detail and number of messages are set with the debug option (see below).
1578     The logfile can be useful for tracking down a problem with Privoxy (e.g.,
1579     it's not blocking an ad you think it should block) and it can help you to
1580     monitor what your browser is doing.
1581
1582     Depending on the debug options below, the logfile may be a privacy risk if
1583     third parties can get access to it. As most users will never look at it,
1584     Privoxy 3.0.7 and later only log fatal errors by default.
1585
1586     For most troubleshooting purposes, you will have to change that, please
1587     refer to the debugging section for details.
1588
1589     Your logfile will grow indefinitely, and you will probably want to
1590     periodically remove it. On Unix systems, you can do this with a cron job
1591     (see "man cron"). For Red Hat based Linux distributions, a logrotate script
1592     has been included.
1593
1594     Any log files must be writable by whatever user Privoxy is being run as (on
1595     Unix, default user id is "privoxy").
1596
1597 -------------------------------------------------------------------------------
1598
1599 7.2.7. jarfile
1600
1601 Specifies:
1602
1603     The file to store intercepted cookies in
1604
1605 Type of value:
1606
1607     File name, relative to logdir
1608
1609 Default value:
1610
1611     Unset (commented out). When activated: jarfile (Unix) or privoxy.jar
1612     (Windows).
1613
1614 Effect if unset:
1615
1616     Intercepted cookies are not stored in a dedicated log file.
1617
1618 Notes:
1619
1620     The jarfile may grow to ridiculous sizes over time.
1621
1622     If debug 8 (show header parsing) is enabled, cookies are also written to
1623     the logfile with the rest of the headers. Therefore this option isn't very
1624     useful and may be removed in future releases. Please report to the
1625     developers if you are still using it.
1626
1627 -------------------------------------------------------------------------------
1628
1629 7.2.8. trustfile
1630
1631 Specifies:
1632
1633     The name of the trust file to use
1634
1635 Type of value:
1636
1637     File name, relative to confdir
1638
1639 Default value:
1640
1641     Unset (commented out). When activated: trust (Unix) or trust.txt (Windows)
1642
1643 Effect if unset:
1644
1645     The entire trust mechanism is disabled.
1646
1647 Notes:
1648
1649     The trust mechanism is an experimental feature for building white-lists and
1650     should be used with care. It is NOT recommended for the casual user.
1651
1652     If you specify a trust file, Privoxy will only allow access to sites that
1653     are specified in the trustfile. Sites can be listed in one of two ways:
1654
1655     Prepending a ~ character limits access to this site only (and any sub-paths
1656     within this site), e.g. ~www.example.com allows access to ~www.example.com/
1657     features/news.html, etc.
1658
1659     Or, you can designate sites as trusted referrers, by prepending the name
1660     with a + character. The effect is that access to untrusted sites will be
1661     granted -- but only if a link from this trusted referrer was used to get
1662     there. The link target will then be added to the "trustfile" so that
1663     future, direct accesses will be granted. Sites added via this mechanism do
1664     not become trusted referrers themselves (i.e. they are added with a ~
1665     designation). There is a limit of 512 such entries, after which new entries
1666     will not be made.
1667
1668     If you use the + operator in the trust file, it may grow considerably over
1669     time.
1670
1671     It is recommended that Privoxy be compiled with the --disable-force,
1672     --disable-toggle and --disable-editor options, if this feature is to be
1673     used.
1674
1675     Possible applications include limiting Internet access for children.
1676
1677 -------------------------------------------------------------------------------
1678
1679 7.3. Debugging
1680
1681 These options are mainly useful when tracing a problem. Note that you might
1682 also want to invoke Privoxy with the --no-daemon command line option when
1683 debugging.
1684
1685 -------------------------------------------------------------------------------
1686
1687 7.3.1. debug
1688
1689 Specifies:
1690
1691     Key values that determine what information gets logged.
1692
1693 Type of value:
1694
1695     Integer values
1696
1697 Default value:
1698
1699     0 (i.e.: only fatal errors (that cause Privoxy to exit) are logged)
1700
1701 Effect if unset:
1702
1703     Default value is used (see above).
1704
1705 Notes:
1706
1707     The available debug levels are:
1708
1709       debug         1 # log each request destination (and the crunch reason if Privoxy intercepted the request)
1710       debug         2 # show each connection status
1711       debug         4 # show I/O status
1712       debug         8 # show header parsing
1713       debug        16 # log all data written to the network into the logfile
1714       debug        32 # debug force feature
1715       debug        64 # debug regular expression filters
1716       debug       128 # debug redirects
1717       debug       256 # debug GIF de-animation
1718       debug       512 # Common Log Format
1719       debug      1024 # debug kill pop-ups
1720       debug      2048 # CGI user interface
1721       debug      4096 # Startup banner and warnings.
1722       debug      8192 # Non-fatal errors
1723
1724
1725     To select multiple debug levels, you can either add them or use multiple
1726     debug lines.
1727
1728     A debug level of 1 is informative because it will show you each request as
1729     it happens. 1, 4096 and 8192 are recommended so that you will notice when
1730     things go wrong. The other levels are probably only of interest if you are
1731     hunting down a specific problem. They can produce a hell of an output
1732     (especially 16).
1733
1734     Privoxy used to ship with the debug levels recommended above enabled by
1735     default, but due to privacy concerns 3.0.7 and later are configured to only
1736     log fatal errors.
1737
1738     If you are used to the more verbose settings, simply enable the debug lines
1739     below again.
1740
1741     If you want to use pure CLF (Common Log Format), you should set "debug 512"
1742     ONLY and not enable anything else.
1743
1744     Privoxy has a hard-coded limit for the length of log messages. If it's
1745     reached, messages are logged truncated and marked with "... [too long,
1746     truncated]".
1747
1748     Please don't file any support requests without trying to reproduce the
1749     problem with increased debug level first. Once you read the log messages,
1750     you may even be able to solve the problem on your own.
1751
1752 -------------------------------------------------------------------------------
1753
1754 7.3.2. single-threaded
1755
1756 Specifies:
1757
1758     Whether to run only one server thread.
1759
1760 Type of value:
1761
1762     None
1763
1764 Default value:
1765
1766     Unset
1767
1768 Effect if unset:
1769
1770     Multi-threaded (or, where unavailable: forked) operation, i.e. the ability
1771     to serve multiple requests simultaneously.
1772
1773 Notes:
1774
1775     This option is only there for debugging purposes. It will drastically
1776     reduce performance.
1777
1778 -------------------------------------------------------------------------------
1779
1780 7.4. Access Control and Security
1781
1782 This section of the config file controls the security-relevant aspects of
1783 Privoxy's configuration.
1784
1785 -------------------------------------------------------------------------------
1786
1787 7.4.1. listen-address
1788
1789 Specifies:
1790
1791     The IP address and TCP port on which Privoxy will listen for client
1792     requests.
1793
1794 Type of value:
1795
1796     [IP-Address]:Port
1797
1798 Default value:
1799
1800     127.0.0.1:8118
1801
1802 Effect if unset:
1803
1804     Bind to 127.0.0.1 (localhost), port 8118. This is suitable and recommended
1805     for home users who run Privoxy on the same machine as their browser.
1806
1807 Notes:
1808
1809     You will need to configure your browser(s) to this proxy address and port.
1810
1811     If you already have another service running on port 8118, or if you want to
1812     serve requests from other machines (e.g. on your local network) as well,
1813     you will need to override the default.
1814
1815     If you leave out the IP address, Privoxy will bind to all interfaces
1816     (addresses) on your machine and may become reachable from the Internet. In
1817     that case, consider using access control lists (ACL's, see below), and/or a
1818     firewall.
1819
1820     If you open Privoxy to untrusted users, you will also want to make sure
1821     that the following actions are disabled: enable-edit-actions and
1822     enable-remote-toggle
1823
1824 Example:
1825
1826     Suppose you are running Privoxy on a machine which has the address
1827     192.168.0.1 on your local private network (192.168.0.0) and has another
1828     outside connection with a different address. You want it to serve requests
1829     from inside only:
1830
1831       listen-address  192.168.0.1:8118
1832
1833
1834 -------------------------------------------------------------------------------
1835
1836 7.4.2. toggle
1837
1838 Specifies:
1839
1840     Initial state of "toggle" status
1841
1842 Type of value:
1843
1844     1 or 0
1845
1846 Default value:
1847
1848     1
1849
1850 Effect if unset:
1851
1852     Act as if toggled on
1853
1854 Notes:
1855
1856     If set to 0, Privoxy will start in "toggled off" mode, i.e. mostly behave
1857     like a normal, content-neutral proxy with both ad blocking and content
1858     filtering disabled. See enable-remote-toggle below.
1859
1860     The windows version will only display the toggle icon in the system tray if
1861     this option is present.
1862
1863 -------------------------------------------------------------------------------
1864
1865 7.4.3. enable-remote-toggle
1866
1867 Specifies:
1868
1869     Whether or not the web-based toggle feature may be used
1870
1871 Type of value:
1872
1873     0 or 1
1874
1875 Default value:
1876
1877     0
1878
1879 Effect if unset:
1880
1881     The web-based toggle feature is disabled.
1882
1883 Notes:
1884
1885     When toggled off, Privoxy mostly acts like a normal, content-neutral proxy,
1886     i.e. doesn't block ads or filter content.
1887
1888     Access to the toggle feature can not be controlled separately by "ACLs" or
1889     HTTP authentication, so that everybody who can access Privoxy (see "ACLs"
1890     and listen-address above) can toggle it for all users. So this option is
1891     not recommended for multi-user environments with untrusted users.
1892
1893     Note that malicious client side code (e.g Java) is also capable of using
1894     this option.
1895
1896     As a lot of Privoxy users don't read documentation, this feature is
1897     disabled by default.
1898
1899     Note that you must have compiled Privoxy with support for this feature,
1900     otherwise this option has no effect.
1901
1902 -------------------------------------------------------------------------------
1903
1904 7.4.4. enable-remote-http-toggle
1905
1906 Specifies:
1907
1908     Whether or not Privoxy recognizes special HTTP headers to change its
1909     behaviour.
1910
1911 Type of value:
1912
1913     0 or 1
1914
1915 Default value:
1916
1917     0
1918
1919 Effect if unset:
1920
1921     Privoxy ignores special HTTP headers.
1922
1923 Notes:
1924
1925     When toggled on, the client can change Privoxy's behaviour by setting
1926     special HTTP headers. Currently the only supported special header is
1927     "X-Filter: No", to disable filtering for the ongoing request, even if it is
1928     enabled in one of the action files.
1929
1930     This feature is disabled by default. If you are using Privoxy in a
1931     environment with trusted clients, you may enable this feature at your
1932     discretion. Note that malicious client side code (e.g Java) is also capable
1933     of using this feature.
1934
1935     This option will be removed in future releases as it has been obsoleted by
1936     the more general header taggers.
1937
1938 -------------------------------------------------------------------------------
1939
1940 7.4.5. enable-edit-actions
1941
1942 Specifies:
1943
1944     Whether or not the web-based actions file editor may be used
1945
1946 Type of value:
1947
1948     0 or 1
1949
1950 Default value:
1951
1952     0
1953
1954 Effect if unset:
1955
1956     The web-based actions file editor is disabled.
1957
1958 Notes:
1959
1960     Access to the editor can not be controlled separately by "ACLs" or HTTP
1961     authentication, so that everybody who can access Privoxy (see "ACLs" and
1962     listen-address above) can modify its configuration for all users.
1963
1964     This option is not recommended for environments with untrusted users and as
1965     a lot of Privoxy users don't read documentation, this feature is disabled
1966     by default.
1967
1968     Note that malicious client side code (e.g Java) is also capable of using
1969     the actions editor and you shouldn't enable this options unless you
1970     understand the consequences and are sure your browser is configured
1971     correctly.
1972
1973     Note that you must have compiled Privoxy with support for this feature,
1974     otherwise this option has no effect.
1975
1976 -------------------------------------------------------------------------------
1977
1978 7.4.6. enforce-blocks
1979
1980 Specifies:
1981
1982     Whether the user is allowed to ignore blocks and can "go there anyway".
1983
1984 Type of value:
1985
1986     0 or 1
1987
1988 Default value:
1989
1990     0
1991
1992 Effect if unset:
1993
1994     Blocks are not enforced.
1995
1996 Notes:
1997
1998     Privoxy is mainly used to block and filter requests as a service to the
1999     user, for example to block ads and other junk that clogs the pipes.
2000     Privoxy's configuration isn't perfect and sometimes innocent pages are
2001     blocked. In this situation it makes sense to allow the user to enforce the
2002     request and have Privoxy ignore the block.
2003
2004     In the default configuration Privoxy's "Blocked" page contains a "go there
2005     anyway" link to adds a special string (the force prefix) to the request
2006     URL. If that link is used, Privoxy will detect the force prefix, remove it
2007     again and let the request pass.
2008
2009     Of course Privoxy can also be used to enforce a network policy. In that
2010     case the user obviously should not be able to bypass any blocks, and that's
2011     what the "enforce-blocks" option is for. If it's enabled, Privoxy hides the
2012     "go there anyway" link. If the user adds the force prefix by hand, it will
2013     not be accepted and the circumvention attempt is logged.
2014
2015 Examples:
2016
2017     enforce-blocks 1
2018
2019 -------------------------------------------------------------------------------
2020
2021 7.4.7. ACLs: permit-access and deny-access
2022
2023 Specifies:
2024
2025     Who can access what.
2026
2027 Type of value:
2028
2029     src_addr[/src_masklen] [dst_addr[/dst_masklen]]
2030
2031     Where src_addr and dst_addr are IP addresses in dotted decimal notation or
2032     valid DNS names, and src_masklen and dst_masklen are subnet masks in CIDR
2033     notation, i.e. integer values from 2 to 30 representing the length (in
2034     bits) of the network address. The masks and the whole destination part are
2035     optional.
2036
2037 Default value:
2038
2039     Unset
2040
2041 Effect if unset:
2042
2043     Don't restrict access further than implied by listen-address
2044
2045 Notes:
2046
2047     Access controls are included at the request of ISPs and systems
2048     administrators, and are not usually needed by individual users. For a
2049     typical home user, it will normally suffice to ensure that Privoxy only
2050     listens on the localhost (127.0.0.1) or internal (home) network address by
2051     means of the listen-address option.
2052
2053     Please see the warnings in the FAQ that Privoxy is not intended to be a
2054     substitute for a firewall or to encourage anyone to defer addressing basic
2055     security weaknesses.
2056
2057     Multiple ACL lines are OK. If any ACLs are specified, Privoxy only talks to
2058     IP addresses that match at least one permit-access line and don't match any
2059     subsequent deny-access line. In other words, the last match wins, with the
2060     default being deny-access.
2061
2062     If Privoxy is using a forwarder (see forward below) for a particular
2063     destination URL, the dst_addr that is examined is the address of the
2064     forwarder and NOT the address of the ultimate target. This is necessary
2065     because it may be impossible for the local Privoxy to determine the IP
2066     address of the ultimate target (that's often what gateways are used for).
2067
2068     You should prefer using IP addresses over DNS names, because the address
2069     lookups take time. All DNS names must resolve! You can not use domain
2070     patterns like "*.org" or partial domain names. If a DNS name resolves to
2071     multiple IP addresses, only the first one is used.
2072
2073     Denying access to particular sites by ACL may have undesired side effects
2074     if the site in question is hosted on a machine which also hosts other sites
2075     (most sites are).
2076
2077 Examples:
2078
2079     Explicitly define the default behavior if no ACL and listen-address are
2080     set: "localhost" is OK. The absence of a dst_addr implies that all
2081     destination addresses are OK:
2082
2083       permit-access  localhost
2084
2085
2086     Allow any host on the same class C subnet as www.privoxy.org access to
2087     nothing but www.example.com (or other domains hosted on the same system):
2088
2089       permit-access  www.privoxy.org/24 www.example.com/32
2090
2091
2092     Allow access from any host on the 26-bit subnet 192.168.45.64 to anywhere,
2093     with the exception that 192.168.45.73 may not access the IP address behind
2094     www.dirty-stuff.example.com:
2095
2096       permit-access  192.168.45.64/26
2097       deny-access    192.168.45.73    www.dirty-stuff.example.com
2098
2099
2100 -------------------------------------------------------------------------------
2101
2102 7.4.8. buffer-limit
2103
2104 Specifies:
2105
2106     Maximum size of the buffer for content filtering.
2107
2108 Type of value:
2109
2110     Size in Kbytes
2111
2112 Default value:
2113
2114     4096
2115
2116 Effect if unset:
2117
2118     Use a 4MB (4096 KB) limit.
2119
2120 Notes:
2121
2122     For content filtering, i.e. the +filter and +deanimate-gif actions, it is
2123     necessary that Privoxy buffers the entire document body. This can be
2124     potentially dangerous, since a server could just keep sending data
2125     indefinitely and wait for your RAM to exhaust -- with nasty consequences.
2126     Hence this option.
2127
2128     When a document buffer size reaches the buffer-limit, it is flushed to the
2129     client unfiltered and no further attempt to filter the rest of the document
2130     is made. Remember that there may be multiple threads running, which might
2131     require up to buffer-limit Kbytes each, unless you have enabled
2132     "single-threaded" above.
2133
2134 -------------------------------------------------------------------------------
2135
2136 7.5. Forwarding
2137
2138 This feature allows routing of HTTP requests through a chain of multiple
2139 proxies.
2140
2141 Forwarding can be used to chain Privoxy with a caching proxy to speed up
2142 browsing. Using a parent proxy may also be necessary if the machine that
2143 Privoxy runs on has no direct Internet access.
2144
2145 Note that parent proxies can severely decrease your privacy level. For example
2146 a parent proxy could add your IP address to the request headers and if it's a
2147 caching proxy it may add the "Etag" header to revalidation requests again, even
2148 though you configured Privoxy to remove it. It may also ignore Privoxy's header
2149 time randomization and use the original values which could be used by the
2150 server as cookie replacement to track your steps between visits.
2151
2152 Also specified here are SOCKS proxies. Privoxy supports the SOCKS 4 and SOCKS
2153 4A protocols.
2154
2155 -------------------------------------------------------------------------------
2156
2157 7.5.1. forward
2158
2159 Specifies:
2160
2161     To which parent HTTP proxy specific requests should be routed.
2162
2163 Type of value:
2164
2165     target_pattern http_parent[:port]
2166
2167     where target_pattern is a URL pattern that specifies to which requests
2168     (i.e. URLs) this forward rule shall apply. Use / to denote "all URLs".
2169     http_parent[:port] is the DNS name or IP address of the parent HTTP proxy
2170     through which the requests should be forwarded, optionally followed by its
2171     listening port (default: 8080). Use a single dot (.) to denote "no
2172     forwarding".
2173
2174 Default value:
2175
2176     Unset
2177
2178 Effect if unset:
2179
2180     Don't use parent HTTP proxies.
2181
2182 Notes:
2183
2184     If http_parent is ".", then requests are not forwarded to another HTTP
2185     proxy but are made directly to the web servers.
2186
2187     Multiple lines are OK, they are checked in sequence, and the last match
2188     wins.
2189
2190 Examples:
2191
2192     Everything goes to an example parent proxy, except SSL on port 443 (which
2193     it doesn't handle):
2194
2195       forward   /      parent-proxy.example.org:8080
2196       forward   :443   .
2197
2198
2199     Everything goes to our example ISP's caching proxy, except for requests to
2200     that ISP's sites:
2201
2202       forward   /                  caching-proxy.isp.example.net:8000
2203       forward   .isp.example.net   .
2204
2205
2206 -------------------------------------------------------------------------------
2207
2208 7.5.2. forward-socks4 and forward-socks4a
2209
2210 Specifies:
2211
2212     Through which SOCKS proxy (and optionally to which parent HTTP proxy)
2213     specific requests should be routed.
2214
2215 Type of value:
2216
2217     target_pattern socks_proxy[:port] http_parent[:port]
2218
2219     where target_pattern is a URL pattern that specifies to which requests
2220     (i.e. URLs) this forward rule shall apply. Use / to denote "all URLs".
2221     http_parent and socks_proxy are IP addresses in dotted decimal notation or
2222     valid DNS names (http_parent may be "." to denote "no HTTP forwarding"),
2223     and the optional port parameters are TCP ports, i.e. integer values from 1
2224     to 64535
2225
2226 Default value:
2227
2228     Unset
2229
2230 Effect if unset:
2231
2232     Don't use SOCKS proxies.
2233
2234 Notes:
2235
2236     Multiple lines are OK, they are checked in sequence, and the last match
2237     wins.
2238
2239     The difference between forward-socks4 and forward-socks4a is that in the
2240     SOCKS 4A protocol, the DNS resolution of the target hostname happens on the
2241     SOCKS server, while in SOCKS 4 it happens locally.
2242
2243     If http_parent is ".", then requests are not forwarded to another HTTP
2244     proxy but are made (HTTP-wise) directly to the web servers, albeit through
2245     a SOCKS proxy.
2246
2247 Examples:
2248
2249     From the company example.com, direct connections are made to all "internal"
2250     domains, but everything outbound goes through their ISP's proxy by way of
2251     example.com's corporate SOCKS 4A gateway to the Internet.
2252
2253       forward-socks4a   /              socks-gw.example.com:1080  www-cache.isp.example.net:8080
2254       forward           .example.com   .
2255
2256
2257     A rule that uses a SOCKS 4 gateway for all destinations but no HTTP parent
2258     looks like this:
2259
2260       forward-socks4   /               socks-gw.example.com:1080  .
2261
2262
2263     To chain Privoxy and Tor, both running on the same system, you would use
2264     something like:
2265
2266       forward-socks4a   /               127.0.0.1:9050 .
2267
2268
2269     The public Tor network can't be used to reach your local network, if you
2270     need to access local servers you therefore might want to make some
2271     exceptions:
2272
2273       forward         192.168.*.*/     .
2274       forward            10.*.*.*/     .
2275       forward           127.*.*.*/     .
2276
2277
2278     Unencrypted connections to systems in these address ranges will be as (un)
2279     secure as the local network is, but the alternative is that you can't reach
2280     the local network through Privoxy at all. Of course this may actually be
2281     desired and there is no reason to make these exceptions if you aren't sure
2282     you need them.
2283
2284     If you also want to be able to reach servers in your local network by using
2285     their names, you will need additional exceptions that look like this:
2286
2287      forward           localhost/     .
2288
2289
2290 -------------------------------------------------------------------------------
2291
2292 7.5.3. Advanced Forwarding Examples
2293
2294 If you have links to multiple ISPs that provide various special content only to
2295 their subscribers, you can configure multiple Privoxies which have connections
2296 to the respective ISPs to act as forwarders to each other, so that your users
2297 can see the internal content of all ISPs.
2298
2299 Assume that host-a has a PPP connection to isp-a.example.net. And host-b has a
2300 PPP connection to isp-b.example.org. Both run Privoxy. Their forwarding
2301 configuration can look like this:
2302
2303 host-a:
2304
2305   forward    /           .
2306   forward    .isp-b.example.net  host-b:8118
2307
2308
2309 host-b:
2310
2311   forward    /           .
2312   forward    .isp-a.example.org  host-a:8118
2313
2314
2315 Now, your users can set their browser's proxy to use either host-a or host-b
2316 and be able to browse the internal content of both isp-a and isp-b.
2317
2318 If you intend to chain Privoxy and squid locally, then chaining as browser ->
2319 squid -> privoxy is the recommended way.
2320
2321 Assuming that Privoxy and squid run on the same box, your squid configuration
2322 could then look like this:
2323
2324   # Define Privoxy as parent proxy (without ICP)
2325   cache_peer 127.0.0.1 parent 8118 7 no-query
2326
2327   # Define ACL for protocol FTP
2328   acl ftp proto FTP
2329
2330   # Do not forward FTP requests to Privoxy
2331   always_direct allow ftp
2332
2333   # Forward all the rest to Privoxy
2334   never_direct allow all
2335
2336
2337 You would then need to change your browser's proxy settings to squid's address
2338 and port. Squid normally uses port 3128. If unsure consult http_port in
2339 squid.conf.
2340
2341 You could just as well decide to only forward requests you suspect of leading
2342 to Windows executables through a virus-scanning parent proxy, say, on
2343 antivir.example.com, port 8010:
2344
2345   forward   /                          .
2346   forward   /.*\.(exe|com|dll|zip)$    antivir.example.com:8010
2347
2348
2349 -------------------------------------------------------------------------------
2350
2351 7.5.4. forwarded-connect-retries
2352
2353 Specifies:
2354
2355     How often Privoxy retries if a forwarded connection request fails.
2356
2357 Type of value:
2358
2359     Number of retries.
2360
2361 Default value:
2362
2363     0
2364
2365 Effect if unset:
2366
2367     Connections forwarded through other proxies are treated like direct
2368     connections and no retry attempts are made.
2369
2370 Notes:
2371
2372     forwarded-connect-retries is mainly interesting for socks4a connections,
2373     where Privoxy can't detect why the connections failed. The connection might
2374     have failed because of a DNS timeout in which case a retry makes sense, but
2375     it might also have failed because the server doesn't exist or isn't
2376     reachable. In this case the retry will just delay the appearance of
2377     Privoxy's error message.
2378
2379     Note that in the context of this option, "forwarded connections" includes
2380     all connections that Privoxy forwards through other proxies. This option is
2381     not limited to the HTTP CONNECT method.
2382
2383     Only use this option, if you are getting lots of forwarding-related error
2384     messages that go away when you try again manually. Start with a small value
2385     and check Privoxy's logfile from time to time, to see how many retries are
2386     usually needed.
2387
2388 Examples:
2389
2390     forwarded-connect-retries 1
2391
2392 -------------------------------------------------------------------------------
2393
2394 7.5.5. accept-intercepted-requests
2395
2396 Specifies:
2397
2398     Whether intercepted requests should be treated as valid.
2399
2400 Type of value:
2401
2402     0 or 1
2403
2404 Default value:
2405
2406     0
2407
2408 Effect if unset:
2409
2410     Only proxy requests are accepted, intercepted requests are treated as
2411     invalid.
2412
2413 Notes:
2414
2415     If you don't trust your clients and want to force them to use Privoxy,
2416     enable this option and configure your packet filter to redirect outgoing
2417     HTTP connections into Privoxy.
2418
2419     Make sure that Privoxy's own requests aren't redirected as well.
2420     Additionally take care that Privoxy can't intentionally connect to itself,
2421     otherwise you could run into redirection loops if Privoxy's listening port
2422     is reachable by the outside or an attacker has access to the pages you
2423     visit.
2424
2425 Examples:
2426
2427     accept-intercepted-requests 1
2428
2429 -------------------------------------------------------------------------------
2430
2431 7.5.6. allow-cgi-request-crunching
2432
2433 Specifies:
2434
2435     Whether requests to Privoxy's CGI pages can be blocked or redirected.
2436
2437 Type of value:
2438
2439     0 or 1
2440
2441 Default value:
2442
2443     0
2444
2445 Effect if unset:
2446
2447     Privoxy ignores block and redirect actions for its CGI pages.
2448
2449 Notes:
2450
2451     By default Privoxy ignores block or redirect actions for its CGI pages.
2452     Intercepting these requests can be useful in multi-user setups to implement
2453     fine-grained access control, but it can also render the complete web
2454     interface useless and make debugging problems painful if done without care.
2455
2456     Don't enable this option unless you're sure that you really need it.
2457
2458 Examples:
2459
2460     allow-cgi-request-crunching 1
2461
2462 -------------------------------------------------------------------------------
2463
2464 7.5.7. split-large-forms
2465
2466 Specifies:
2467
2468     Whether the CGI interface should stay compatible with broken HTTP clients.
2469
2470 Type of value:
2471
2472     0 or 1
2473
2474 Default value:
2475
2476     0
2477
2478 Effect if unset:
2479
2480     The CGI form generate long GET URLs.
2481
2482 Notes:
2483
2484     Privoxy's CGI forms can lead to rather long URLs. This isn't a problem as
2485     far as the HTTP standard is concerned, but it can confuse clients with
2486     arbitrary URL length limitations.
2487
2488     Enabling split-large-forms causes Privoxy to divide big forms into smaller
2489     ones to keep the URL length down. It makes editing a lot less convenient
2490     and you can no longer submit all changes at once, but at least it works
2491     around this browser bug.
2492
2493     If you don't notice any editing problems, there is no reason to enable this
2494     option, but if one of the submit buttons appears to be broken, you should
2495     give it a try.
2496
2497 Examples:
2498
2499     split-large-forms 1
2500
2501 -------------------------------------------------------------------------------
2502
2503 7.6. Windows GUI Options
2504
2505 Privoxy has a number of options specific to the Windows GUI interface:
2506
2507 If "activity-animation" is set to 1, the Privoxy icon will animate when
2508 "Privoxy" is active. To turn off, set to 0.
2509
2510   activity-animation 1
2511    
2512
2513 If "log-messages" is set to 1, Privoxy will log messages to the console window:
2514
2515   log-messages 1
2516    
2517
2518 If "log-buffer-size" is set to 1, the size of the log buffer, i.e. the amount
2519 of memory used for the log messages displayed in the console window, will be
2520 limited to "log-max-lines" (see below).
2521
2522 Warning: Setting this to 0 will result in the buffer to grow infinitely and eat
2523 up all your memory!
2524
2525   log-buffer-size 1
2526    
2527
2528 log-max-lines is the maximum number of lines held in the log buffer. See above.
2529
2530   log-max-lines 200
2531    
2532
2533 If "log-highlight-messages" is set to 1, Privoxy will highlight portions of the
2534 log messages with a bold-faced font:
2535
2536   log-highlight-messages 1
2537    
2538
2539 The font used in the console window:
2540
2541   log-font-name Comic Sans MS
2542    
2543
2544 Font size used in the console window:
2545
2546   log-font-size 8
2547    
2548
2549 "show-on-task-bar" controls whether or not Privoxy will appear as a button on
2550 the Task bar when minimized:
2551
2552   show-on-task-bar 0
2553    
2554
2555 If "close-button-minimizes" is set to 1, the Windows close button will minimize
2556 Privoxy instead of closing the program (close with the exit option on the File
2557 menu).
2558
2559   close-button-minimizes 1
2560    
2561
2562 The "hide-console" option is specific to the MS-Win console version of Privoxy.
2563 If this option is used, Privoxy will disconnect from and hide the command
2564 console.
2565
2566   #hide-console
2567    
2568
2569 -------------------------------------------------------------------------------
2570
2571 8. Actions Files
2572
2573 The actions files are used to define what actions Privoxy takes for which URLs,
2574 and thus determines how ad images, cookies and various other aspects of HTTP
2575 content and transactions are handled, and on which sites (or even parts
2576 thereof). There are a number of such actions, with a wide range of
2577 functionality. Each action does something a little different. These actions
2578 give us a veritable arsenal of tools with which to exert our control,
2579 preferences and independence. Actions can be combined so that their effects are
2580 aggregated when applied against a given set of URLs.
2581
2582 There are three action files included with Privoxy with differing purposes:
2583
2584   * default.action - is the primary action file that sets the initial values
2585     for all actions. It is intended to provide a base level of functionality
2586     for Privoxy's array of features. So it is a set of broad rules that should
2587     work reasonably well as-is for most users. This is the file that the
2588     developers are keeping updated, and making available to users. The user's
2589     preferences as set in standard.action, e.g. either Cautious (the default),
2590     Medium, or Advanced (see below).
2591
2592   * user.action - is intended to be for local site preferences and exceptions.
2593     As an example, if your ISP or your bank has specific requirements, and need
2594     special handling, this kind of thing should go here. This file will not be
2595     upgraded.
2596
2597   * standard.action - is used only by the web based editor at http://
2598     config.privoxy.org/edit-actions-list?f=default, to set various pre-defined
2599     sets of rules for the default actions section in default.action.
2600
2601     Edit Set to Cautious Set to Medium Set to Advanced
2602
2603     These have increasing levels of aggressiveness and have no influence on
2604     your browsing unless you select them explicitly in the editor. A default
2605     installation should be pre-set to Cautious (versions prior to 3.0.5 were
2606     set to Medium). New users should try this for a while before adjusting the
2607     settings to more aggressive levels. The more aggressive the settings, then
2608     the more likelihood there is of problems such as sites not working as they
2609     should.
2610
2611     The Edit button allows you to turn each action on/off individually for
2612     fine-tuning. The Cautious button changes the actions list to low/safe
2613     settings which will activate ad blocking and a minimal set of Privoxy's
2614     features, and subsequently there will be less of a chance for accidental
2615     problems. The Medium button sets the list to a medium level of other
2616     features and a low level set of privacy features. The Advanced button sets
2617     the list to a high level of ad blocking and medium level of privacy. See
2618     the chart below. The latter three buttons over-ride any changes via with
2619     the Edit button. More fine-tuning can be done in the lower sections of this
2620     internal page.
2621
2622     It is not recommend to edit the standard.action file itself.
2623
2624     The default profiles, and their associated actions, as pre-defined in
2625     standard.action are:
2626
2627     Table 1. Default Configurations
2628
2629     +---------------------------------------------------------------+
2630     |         Feature          | Cautious  |   Medium   | Advanced  |
2631     |--------------------------+-----------+------------+-----------|
2632     |Ad-blocking Aggressiveness|medium     |high        |high       |
2633     |--------------------------+-----------+------------+-----------|
2634     |Ad-filtering by size      |no         |yes         |yes        |
2635     |--------------------------+-----------+------------+-----------|
2636     |Ad-filtering by link      |no         |no          |yes        |
2637     |--------------------------+-----------+------------+-----------|
2638     |Pop-up killing            |blocks only|blocks only |blocks only|
2639     |--------------------------+-----------+------------+-----------|
2640     |Privacy Features          |low        |medium      |medium/high|
2641     |--------------------------+-----------+------------+-----------|
2642     |Cookie handling           |none       |session-only|kill       |
2643     |--------------------------+-----------+------------+-----------|
2644     |Referer forging           |no         |yes         |yes        |
2645     |--------------------------+-----------+------------+-----------|
2646     |GIF de-animation          |no         |yes         |yes        |
2647     |--------------------------+-----------+------------+-----------|
2648     |Fast redirects            |no         |no          |yes        |
2649     |--------------------------+-----------+------------+-----------|
2650     |HTML taming               |no         |no          |yes        |
2651     |--------------------------+-----------+------------+-----------|
2652     |JavaScript taming         |no         |no          |yes        |
2653     |--------------------------+-----------+------------+-----------|
2654     |Web-bug killing           |no         |yes         |yes        |
2655     |--------------------------+-----------+------------+-----------|
2656     |Image tag reordering      |no         |no          |yes        |
2657     +---------------------------------------------------------------+
2658
2659 The list of actions files to be used are defined in the main configuration
2660 file, and are processed in the order they are defined (e.g. default.action is
2661 typically processed before user.action). The content of these can all be viewed
2662 and edited from http://config.privoxy.org/show-status. The over-riding
2663 principle when applying actions, is that the last action that matches a given
2664 URL wins. The broadest, most general rules go first (defined in
2665 default.action), followed by any exceptions (typically also in default.action),
2666 which are then followed lastly by any local preferences (typically in
2667 user.action). Generally, user.action has the last word.
2668
2669 An actions file typically has multiple sections. If you want to use "aliases"
2670 in an actions file, you have to place the (optional) alias section at the top
2671 of that file. Then comes the default set of rules which will apply universally
2672 to all sites and pages (be very careful with using such a universal set in
2673 user.action or any other actions file after default.action, because it will
2674 override the result from consulting any previous file). And then below that,
2675 exceptions to the defined universal policies. You can regard user.action as an
2676 appendix to default.action, with the advantage that it is a separate file,
2677 which makes preserving your personal settings across Privoxy upgrades easier.
2678
2679 Actions can be used to block anything you want, including ads, banners, or just
2680 some obnoxious URL whose content you would rather not see. Cookies can be
2681 accepted or rejected, or accepted only during the current browser session (i.e.
2682 not written to disk), content can be modified, some JavaScripts tamed,
2683 user-tracking fooled, and much more. See below for a complete list of actions.
2684
2685 -------------------------------------------------------------------------------
2686
2687 8.1. Finding the Right Mix
2688
2689 Note that some actions, like cookie suppression or script disabling, may render
2690 some sites unusable that rely on these techniques to work properly. Finding the
2691 right mix of actions is not always easy and certainly a matter of personal
2692 taste. And, things can always change, requiring refinements in the
2693 configuration. In general, it can be said that the more "aggressive" your
2694 default settings (in the top section of the actions file) are, the more
2695 exceptions for "trusted" sites you will have to make later. If, for example,
2696 you want to crunch all cookies per default, you'll have to make exceptions from
2697 that rule for sites that you regularly use and that require cookies for
2698 actually useful purposes, like maybe your bank, favorite shop, or newspaper.
2699
2700 We have tried to provide you with reasonable rules to start from in the
2701 distribution actions files. But there is no general rule of thumb on these
2702 things. There just are too many variables, and sites are constantly changing.
2703 Sooner or later you will want to change the rules (and read this chapter again
2704 :).
2705
2706 -------------------------------------------------------------------------------
2707
2708 8.2. How to Edit
2709
2710 The easiest way to edit the actions files is with a browser by using our
2711 browser-based editor, which can be reached from http://config.privoxy.org/
2712 show-status. Note: the config file option enable-edit-actions must be enabled
2713 for this to work. The editor allows both fine-grained control over every single
2714 feature on a per-URL basis, and easy choosing from wholesale sets of defaults
2715 like "Cautious", "Medium" or "Advanced". Warning: the "Advanced" setting is
2716 more aggressive, and will be more likely to cause problems for some sites.
2717 Experienced users only!
2718
2719 If you prefer plain text editing to GUIs, you can of course also directly edit
2720 the the actions files with your favorite text editor. Look at default.action
2721 which is richly commented with many good examples.
2722
2723 -------------------------------------------------------------------------------
2724
2725 8.3. How Actions are Applied to Requests
2726
2727 Actions files are divided into sections. There are special sections, like the "
2728 alias" sections which will be discussed later. For now let's concentrate on
2729 regular sections: They have a heading line (often split up to multiple lines
2730 for readability) which consist of a list of actions, separated by whitespace
2731 and enclosed in curly braces. Below that, there is a list of URL and tag
2732 patterns, each on a separate line.
2733
2734 To determine which actions apply to a request, the URL of the request is
2735 compared to all URL patterns in each "action file". Every time it matches, the
2736 list of applicable actions for the request is incrementally updated, using the
2737 heading of the section in which the pattern is located. The same is done again
2738 for tags and tag patterns later on.
2739
2740 If multiple applying sections set the same action differently, the last match
2741 wins. If not, the effects are aggregated. E.g. a URL might match a regular
2742 section with a heading line of { +handle-as-image }, then later another one
2743 with just { +block }, resulting in both actions to apply. And there may well be
2744 cases where you will want to combine actions together. Such a section then
2745 might look like:
2746
2747   { +handle-as-image  +block }
2748   # Block these as if they were images. Send no block page.
2749    banners.example.com
2750    media.example.com/.*banners
2751    .example.com/images/ads/
2752
2753
2754 You can trace this process for URL patterns and any given URL by visiting http:
2755 //config.privoxy.org/show-url-info.
2756
2757 Examples and more detail on this is provided in the Appendix, Troubleshooting:
2758 Anatomy of an Action section.
2759
2760 -------------------------------------------------------------------------------
2761
2762 8.4. Patterns
2763
2764 As mentioned, Privoxy uses "patterns" to determine what actions might apply to
2765 which sites and pages your browser attempts to access. These "patterns" use
2766 wild card type pattern matching to achieve a high degree of flexibility. This
2767 allows one expression to be expanded and potentially match against many similar
2768 patterns.
2769
2770 Generally, an URL pattern has the form <domain>/<path>, where both the <domain>
2771 and <path> are optional. (This is why the special / pattern matches all URLs).
2772 Note that the protocol portion of the URL pattern (e.g. http://) should not be
2773 included in the pattern. This is assumed already!
2774
2775 The pattern matching syntax is different for the domain and path parts of the
2776 URL. The domain part uses a simple globbing type matching technique, while the
2777 path part uses a more flexible "Regular Expressions (PCRE)" based syntax.
2778
2779 www.example.com/
2780
2781     is a domain-only pattern and will match any request to www.example.com,
2782     regardless of which document on that server is requested. So ALL pages in
2783     this domain would be covered by the scope of this action. Note that a
2784     simple example.com is different and would NOT match.
2785
2786 www.example.com
2787
2788     means exactly the same. For domain-only patterns, the trailing / may be
2789     omitted.
2790
2791 www.example.com/index.html$
2792
2793     matches all the documents on www.example.com whose name starts with /
2794     index.html.
2795
2796 www.example.com/index.html$
2797
2798     matches only the single document /index.html on www.example.com.
2799
2800 /index.html$
2801
2802     matches the document /index.html, regardless of the domain, i.e. on any web
2803     server anywhere.
2804
2805 index.html
2806
2807     matches nothing, since it would be interpreted as a domain name and there
2808     is no top-level domain called .html. So its a mistake.
2809
2810 -------------------------------------------------------------------------------
2811
2812 8.4.1. The Domain Pattern
2813
2814 The matching of the domain part offers some flexible options: if the domain
2815 starts or ends with a dot, it becomes unanchored at that end. For example:
2816
2817 .example.com
2818
2819     matches any domain with first-level domain com and second-level domain
2820     example. For example www.example.com, example.com and
2821     foo.bar.baz.example.com. Note that it wouldn't match if the second-level
2822     domain was another-example.
2823
2824 www.
2825
2826     matches any domain that STARTS with www. (It also matches the domain www
2827     but most of the time that doesn't matter.)
2828
2829 .example.
2830
2831     matches any domain that CONTAINS .example.. And, by the way, also included
2832     would be any files or documents that exist within that domain since no path
2833     limitations are specified. (Correctly speaking: It matches any FQDN that
2834     contains example as a domain.) This might be www.example.com,
2835     news.example.de, or www.example.net/cgi/testing.pl for instance. All these
2836     cases are matched.
2837
2838 Additionally, there are wild-cards that you can use in the domain names
2839 themselves. These work similarly to shell globbing type wild-cards: "*"
2840 represents zero or more arbitrary characters (this is equivalent to the
2841 "Regular Expression" based syntax of ".*"), "?" represents any single character
2842 (this is equivalent to the regular expression syntax of a simple "."), and you
2843 can define "character classes" in square brackets which is similar to the same
2844 regular expression technique. All of this can be freely mixed:
2845
2846 ad*.example.com
2847
2848     matches "adserver.example.com", "ads.example.com", etc but not
2849     "sfads.example.com"
2850
2851 *ad*.example.com
2852
2853     matches all of the above, and then some.
2854
2855 .?pix.com
2856
2857     matches www.ipix.com, pictures.epix.com, a.b.c.d.e.upix.com etc.
2858
2859 www[1-9a-ez].example.c*
2860
2861     matches www1.example.com, www4.example.cc, wwwd.example.cy,
2862     wwwz.example.com etc., but not wwww.example.com.
2863
2864 While flexible, this is not the sophistication of full regular expression based
2865 syntax.
2866
2867 -------------------------------------------------------------------------------
2868
2869 8.4.2. The Path Pattern
2870
2871 Privoxy uses Perl compatible (PCRE) "Regular Expression" based syntax (through
2872 the PCRE library) for matching the path portion (after the slash), and is thus
2873 more flexible.
2874
2875 There is an Appendix with a brief quick-start into regular expressions, and
2876 full (very technical) documentation on PCRE regex syntax is available on-line
2877 at http://www.pcre.org/man.txt. You might also find the Perl man page on
2878 regular expressions (man perlre) useful, which is available on-line at http://
2879 perldoc.perl.org/perlre.html.
2880
2881 Note that the path pattern is automatically left-anchored at the "/", i.e. it
2882 matches as if it would start with a "^" (regular expression speak for the
2883 beginning of a line).
2884
2885 Please also note that matching in the path is CASE INSENSITIVE by default, but
2886 you can switch to case sensitive at any point in the pattern by using the "(?
2887 -i)" switch: www.example.com/(?-i)PaTtErN.* will match only documents whose
2888 path starts with PaTtErN in exactly this capitalization.
2889
2890 .example.com/.*
2891
2892     Is equivalent to just ".example.com", since any documents within that
2893     domain are matched with or without the ".*" regular expression. This is
2894     redundant
2895
2896 .example.com/.*/index.html$
2897
2898     Will match any page in the domain of "example.com" that is named
2899     "index.html", and that is part of some path. For example, it matches
2900     "www.example.com/testing/index.html" but NOT "www.example.com/index.html"
2901     because the regular expression called for at least two "/'s", thus the path
2902     requirement. It also would match "www.example.com/testing/index_html",
2903     because of the special meta-character ".".
2904
2905 .example.com/(.*/)?index\.html$
2906
2907     This regular expression is conditional so it will match any page named
2908     "index.html" regardless of path which in this case can have one or more "/
2909     's". And this one must contain exactly ".html" (but does not have to end
2910     with that!).
2911
2912 .example.com/(.*/)(ads|banners?|junk)
2913
2914     This regular expression will match any path of "example.com" that contains
2915     any of the words "ads", "banner", "banners" (because of the "?") or "junk".
2916     The path does not have to end in these words, just contain them.
2917
2918 .example.com/(.*/)(ads|banners?|junk)/.*\.(jpe?g|gif|png)$
2919
2920     This is very much the same as above, except now it must end in either
2921     ".jpg", ".jpeg", ".gif" or ".png". So this one is limited to common image
2922     formats.
2923
2924 There are many, many good examples to be found in default.action, and more
2925 tutorials below in Appendix on regular expressions.
2926
2927 -------------------------------------------------------------------------------
2928
2929 8.4.3. The Tag Pattern
2930
2931 Tag patterns are used to change the applying actions based on the request's
2932 tags. Tags can be created with either the client-header-tagger or the
2933 server-header-tagger action.
2934
2935 Tag patterns have to start with "TAG:", so Privoxy can tell them apart from URL
2936 patterns. Everything after the colon including white space, is interpreted as a
2937 regular expression with path pattern syntax, except that tag patterns aren't
2938 left-anchored automatically (Privoxy doesn't silently add a "^", you have to do
2939 it yourself if you need it).
2940
2941 To match all requests that are tagged with "foo" your pattern line should be
2942 "TAG:^foo$", "TAG:foo" would work as well, but it would also match requests
2943 whose tags contain "foo" somewhere. "TAG: foo" wouldn't work as it requires
2944 white space.
2945
2946 Sections can contain URL and tag patterns at the same time, but tag patterns
2947 are checked after the URL patterns and thus always overrule them, even if they
2948 are located before the URL patterns.
2949
2950 Once a new tag is added, Privoxy checks right away if it's matched by one of
2951 the tag patterns and updates the action settings accordingly. As a result tags
2952 can be used to activate other tagger actions, as long as these other taggers
2953 look for headers that haven't already be parsed.
2954
2955 For example you could tag client requests which use the POST method, then use
2956 this tag to activate another tagger that adds a tag if cookies are sent, and
2957 then use a block action based on the cookie tag. This allows the outcome of one
2958 action, to be input into a subsequent action. However if you'd reverse the
2959 position of the described taggers, and activated the method tagger based on the
2960 cookie tagger, no method tags would be created. The method tagger would look
2961 for the request line, but at the time the cookie tag is created, the request
2962 line has already been parsed.
2963
2964 While this is a limitation you should be aware of, this kind of indirection is
2965 seldom needed anyway and even the example doesn't make too much sense.
2966
2967 -------------------------------------------------------------------------------
2968
2969 8.5. Actions
2970
2971 All actions are disabled by default, until they are explicitly enabled
2972 somewhere in an actions file. Actions are turned on if preceded with a "+", and
2973 turned off if preceded with a "-". So a +action means "do that action", e.g.
2974 +block means "please block URLs that match the following patterns", and -block
2975 means "don't block URLs that match the following patterns, even if +block
2976 previously applied." 
2977
2978 Again, actions are invoked by placing them on a line, enclosed in curly braces
2979 and separated by whitespace, like in {+some-action -some-other-action
2980 {some-parameter}}, followed by a list of URL patterns, one per line, to which
2981 they apply. Together, the actions line and the following pattern lines make up
2982 a section of the actions file.
2983
2984 Actions fall into three categories:
2985
2986   * Boolean, i.e the action can only be "enabled" or "disabled". Syntax:
2987
2988       +name        # enable action name
2989       -name        # disable action name
2990
2991
2992     Example: +block
2993
2994   * Parameterized, where some value is required in order to enable this type of
2995     action. Syntax:
2996
2997       +name{param}  # enable action and set parameter to param,
2998                    # overwriting parameter from previous match if necessary
2999       -name         # disable action. The parameter can be omitted
3000
3001
3002     Note that if the URL matches multiple positive forms of a parameterized
3003     action, the last match wins, i.e. the params from earlier matches are
3004     simply ignored.
3005
3006     Example: +hide-user-agent{Mozilla/5.0 (X11; U; FreeBSD i386; en-US;
3007     rv:1.8.1.4) Gecko/20070602 Firefox/2.0.0.4}
3008
3009   * Multi-value. These look exactly like parameterized actions, but they behave
3010     differently: If the action applies multiple times to the same URL, but with
3011     different parameters, all the parameters from all matches are remembered.
3012     This is used for actions that can be executed for the same request
3013     repeatedly, like adding multiple headers, or filtering through multiple
3014     filters. Syntax:
3015
3016       +name{param}   # enable action and add param to the list of parameters
3017       -name{param}   # remove the parameter param from the list of parameters
3018                     # If it was the last one left, disable the action.
3019       -name          # disable this action completely and remove all parameters from the list
3020
3021
3022     Examples: +add-header{X-Fun-Header: Some text} and +filter{html-annoyances}
3023
3024 If nothing is specified in any actions file, no "actions" are taken. So in this
3025 case Privoxy would just be a normal, non-blocking, non-filtering proxy. You
3026 must specifically enable the privacy and blocking features you need (although
3027 the provided default actions files will give a good starting point).
3028
3029 Later defined action sections always over-ride earlier ones of the same type.
3030 So exceptions to any rules you make, should come in the latter part of the file
3031 (or in a file that is processed later when using multiple actions files such as
3032 user.action). For multi-valued actions, the actions are applied in the order
3033 they are specified. Actions files are processed in the order they are defined
3034 in config (the default installation has three actions files). It also quite
3035 possible for any given URL to match more than one "pattern" (because of
3036 wildcards and regular expressions), and thus to trigger more than one set of
3037 actions! Last match wins.
3038
3039 The list of valid Privoxy actions are:
3040
3041 -------------------------------------------------------------------------------
3042
3043 8.5.1. add-header
3044
3045 Typical use:
3046
3047     Confuse log analysis, custom applications
3048
3049 Effect:
3050
3051     Sends a user defined HTTP header to the web server.
3052
3053 Type:
3054
3055     Multi-value.
3056
3057 Parameter:
3058
3059     Any string value is possible. Validity of the defined HTTP headers is not
3060     checked. It is recommended that you use the "X-" prefix for custom headers.
3061
3062 Notes:
3063
3064     This action may be specified multiple times, in order to define multiple
3065     headers. This is rarely needed for the typical user. If you don't know what
3066     "HTTP headers" are, you definitely don't need to worry about this one.
3067
3068 Example usage:
3069
3070     +add-header{X-User-Tracking: sucks}
3071
3072
3073 -------------------------------------------------------------------------------
3074
3075 8.5.2. block
3076
3077 Typical use:
3078
3079     Block ads or other unwanted content
3080
3081 Effect:
3082
3083     Requests for URLs to which this action applies are blocked, i.e. the
3084     requests are trapped by Privoxy and the requested URL is never retrieved,
3085     but is answered locally with a substitute page or image, as determined by
3086     the handle-as-image, set-image-blocker, and handle-as-empty-document
3087     actions.
3088
3089 Type:
3090
3091     Boolean.
3092
3093 Parameter:
3094
3095     N/A
3096
3097 Notes:
3098
3099     Privoxy sends a special "BLOCKED" page for requests to blocked pages. This
3100     page contains links to find out why the request was blocked, and a
3101     click-through to the blocked content (the latter only if compiled with the
3102     force feature enabled). The "BLOCKED" page adapts to the available screen
3103     space -- it displays full-blown if space allows, or miniaturized and
3104     text-only if loaded into a small frame or window. If you are using Privoxy
3105     right now, you can take a look at the "BLOCKED" page.
3106
3107     A very important exception occurs if both block and handle-as-image, apply
3108     to the same request: it will then be replaced by an image. If
3109     set-image-blocker (see below) also applies, the type of image will be
3110     determined by its parameter, if not, the standard checkerboard pattern is
3111     sent.
3112
3113     It is important to understand this process, in order to understand how
3114     Privoxy deals with ads and other unwanted content. Blocking is a core
3115     feature, and one upon which various other features depend.
3116
3117     The filter action can perform a very similar task, by "blocking" banner
3118     images and other content through rewriting the relevant URLs in the
3119     document's HTML source, so they don't get requested in the first place.
3120     Note that this is a totally different technique, and it's easy to confuse
3121     the two.
3122
3123 Example usage (section):
3124
3125     {+block}
3126     # Block and replace with "blocked" page
3127      .nasty-stuff.example.com
3128
3129     {+block +handle-as-image}
3130     # Block and replace with image
3131      .ad.doubleclick.net
3132      .ads.r.us/banners/
3133
3134     {+block +handle-as-empty-document}
3135     # Block and then ignore
3136      adserver.exampleclick.net/.*\.js$
3137
3138
3139 -------------------------------------------------------------------------------
3140
3141 8.5.3. client-header-filter
3142
3143 Typical use:
3144
3145     Rewrite or remove single client headers.
3146
3147 Effect:
3148
3149     All client headers to which this action applies are filtered on-the-fly
3150     through the specified regular expression based substitutions.
3151
3152 Type:
3153
3154     Parameterized.
3155
3156 Parameter:
3157
3158     The name of a client-header filter, as defined in one of the filter files.
3159
3160 Notes:
3161
3162     Client-header filters are applied to each header on its own, not to all at
3163     once. This makes it easier to diagnose problems, but on the downside you
3164     can't write filters that only change header x if header y's value is z. You
3165     can do that by using tags though.
3166
3167     Client-header filters are executed after the other header actions have
3168     finished and use their output as input.
3169
3170     If the request URL gets changed, Privoxy will detect that and use the new
3171     one. This can be used to rewrite the request destination behind the
3172     client's back, for example to specify a Tor exit relay for certain
3173     requests.
3174
3175     Please refer to the filter file chapter to learn which client-header
3176     filters are available by default, and how to create your own.
3177
3178 Example usage (section):
3179
3180     {+client-header-filter{hide-tor-exit-notation}}
3181     .exit/
3182
3183
3184
3185 -------------------------------------------------------------------------------
3186
3187 8.5.4. client-header-tagger
3188
3189 Typical use:
3190
3191     Block requests based on their headers.
3192
3193 Effect:
3194
3195     Client headers to which this action applies are filtered on-the-fly through
3196     the specified regular expression based substitutions, the result is used as
3197     tag.
3198
3199 Type:
3200
3201     Parameterized.
3202
3203 Parameter:
3204
3205     The name of a client-header tagger, as defined in one of the filter files.
3206
3207 Notes:
3208
3209     Client-header taggers are applied to each header on its own, and as the
3210     header isn't modified, each tagger "sees" the original.
3211
3212     Client-header taggers are the first actions that are executed and their
3213     tags can be used to control every other action.
3214
3215 Example usage (section):
3216
3217     # Tag every request with the User-Agent header
3218     {+client-header-tagger{user-agent}}
3219     /
3220
3221
3222
3223 -------------------------------------------------------------------------------
3224
3225 8.5.5. content-type-overwrite
3226
3227 Typical use:
3228
3229     Stop useless download menus from popping up, or change the browser's
3230     rendering mode
3231
3232 Effect:
3233
3234     Replaces the "Content-Type:" HTTP server header.
3235
3236 Type:
3237
3238     Parameterized.
3239
3240 Parameter:
3241
3242     Any string.
3243
3244 Notes:
3245
3246     The "Content-Type:" HTTP server header is used by the browser to decide
3247     what to do with the document. The value of this header can cause the
3248     browser to open a download menu instead of displaying the document by
3249     itself, even if the document's format is supported by the browser.
3250
3251     The declared content type can also affect which rendering mode the browser
3252     chooses. If XHTML is delivered as "text/html", many browsers treat it as
3253     yet another broken HTML document. If it is send as "application/xml",
3254     browsers with XHTML support will only display it, if the syntax is correct.
3255
3256     If you see a web site that proudly uses XHTML buttons, but sets
3257     "Content-Type: text/html", you can use Privoxy to overwrite it with
3258     "application/xml" and validate the web master's claim inside your
3259     XHTML-supporting browser. If the syntax is incorrect, the browser will
3260     complain loudly.
3261
3262     You can also go the opposite direction: if your browser prints error
3263     messages instead of rendering a document falsely declared as XHTML, you can
3264     overwrite the content type with "text/html" and have it rendered as broken
3265     HTML document.
3266
3267     By default content-type-overwrite only replaces "Content-Type:" headers
3268     that look like some kind of text. If you want to overwrite it
3269     unconditionally, you have to combine it with force-text-mode. This
3270     limitation exists for a reason, think twice before circumventing it.
3271
3272     Most of the time it's easier to replace this action with a custom
3273     server-header filter. It allows you to activate it for every document of a
3274     certain site and it will still only replace the content types you aimed at.
3275
3276     Of course you can apply content-type-overwrite to a whole site and then
3277     make URL based exceptions, but it's a lot more work to get the same
3278     precision.
3279
3280 Example usage (sections):
3281
3282     # Check if www.example.net/ really uses valid XHTML
3283     { +content-type-overwrite{application/xml} }
3284     www.example.net/
3285
3286     # but leave the content type unmodified if the URL looks like a style sheet
3287     {-content-type-overwrite}
3288     www.example.net/.*\.css$
3289     www.example.net/.*style
3290
3291
3292 -------------------------------------------------------------------------------
3293
3294 8.5.6. crunch-client-header
3295
3296 Typical use:
3297
3298     Remove a client header Privoxy has no dedicated action for.
3299
3300 Effect:
3301
3302     Deletes every header sent by the client that contains the string the user
3303     supplied as parameter.
3304
3305 Type:
3306
3307     Parameterized.
3308
3309 Parameter:
3310
3311     Any string.
3312
3313 Notes:
3314
3315     This action allows you to block client headers for which no dedicated
3316     Privoxy action exists. Privoxy will remove every client header that
3317     contains the string you supplied as parameter.
3318
3319     Regular expressions are not supported and you can't use this action to
3320     block different headers in the same request, unless they contain the same
3321     string.
3322
3323     crunch-client-header is only meant for quick tests. If you have to block
3324     several different headers, or only want to modify parts of them, you should
3325     use a client-header filter.
3326
3327     +-----------------------------------------------------------------+
3328     |                             Warning                             |
3329     |-----------------------------------------------------------------|
3330     |Don't block any header without understanding the consequences.   |
3331     +-----------------------------------------------------------------+
3332 Example usage (section):
3333
3334     # Block the non-existent "Privacy-Violation:" client header
3335     { +crunch-client-header{Privacy-Violation:} }
3336     /
3337
3338
3339
3340 -------------------------------------------------------------------------------
3341
3342 8.5.7. crunch-if-none-match
3343
3344 Typical use:
3345
3346     Prevent yet another way to track the user's steps between sessions.
3347
3348 Effect:
3349
3350     Deletes the "If-None-Match:" HTTP client header.
3351
3352 Type:
3353
3354     Boolean.
3355
3356 Parameter:
3357
3358     N/A
3359
3360 Notes:
3361
3362     Removing the "If-None-Match:" HTTP client header is useful for filter
3363     testing, where you want to force a real reload instead of getting status
3364     code "304" which would cause the browser to use a cached copy of the page.
3365
3366     It is also useful to make sure the header isn't used as a cookie
3367     replacement (unlikely but possible).
3368
3369     Blocking the "If-None-Match:" header shouldn't cause any caching problems,
3370     as long as the "If-Modified-Since:" header isn't blocked or missing as
3371     well.
3372
3373     It is recommended to use this action together with hide-if-modified-since
3374     and overwrite-last-modified.
3375
3376 Example usage (section):
3377
3378     # Let the browser revalidate cached documents but don't
3379     # allow the server to use the revalidation headers for user tracking.
3380     {+hide-if-modified-since{-60} \
3381      +overwrite-last-modified{randomize} \
3382      +crunch-if-none-match}
3383     /
3384
3385
3386 -------------------------------------------------------------------------------
3387
3388 8.5.8. crunch-incoming-cookies
3389
3390 Typical use:
3391
3392     Prevent the web server from setting HTTP cookies on your system
3393
3394 Effect:
3395
3396     Deletes any "Set-Cookie:" HTTP headers from server replies.
3397
3398 Type:
3399
3400     Boolean.
3401
3402 Parameter:
3403
3404     N/A
3405
3406 Notes:
3407
3408     This action is only concerned with incoming HTTP cookies. For outgoing HTTP
3409     cookies, use crunch-outgoing-cookies. Use both to disable HTTP cookies
3410     completely.
3411
3412     It makes no sense at all to use this action in conjunction with the
3413     session-cookies-only action, since it would prevent the session cookies
3414     from being set. See also filter-content-cookies.
3415
3416 Example usage:
3417
3418     +crunch-incoming-cookies
3419
3420
3421 -------------------------------------------------------------------------------
3422
3423 8.5.9. crunch-server-header
3424
3425 Typical use:
3426
3427     Remove a server header Privoxy has no dedicated action for.
3428
3429 Effect:
3430
3431     Deletes every header sent by the server that contains the string the user
3432     supplied as parameter.
3433
3434 Type:
3435
3436     Parameterized.
3437
3438 Parameter:
3439
3440     Any string.
3441
3442 Notes:
3443
3444     This action allows you to block server headers for which no dedicated
3445     Privoxy action exists. Privoxy will remove every server header that
3446     contains the string you supplied as parameter.
3447
3448     Regular expressions are not supported and you can't use this action to
3449     block different headers in the same request, unless they contain the same
3450     string.
3451
3452     crunch-server-header is only meant for quick tests. If you have to block
3453     several different headers, or only want to modify parts of them, you should
3454     use a custom server-header filter.
3455
3456     +-----------------------------------------------------------------+
3457     |                             Warning                             |
3458     |-----------------------------------------------------------------|
3459     |Don't block any header without understanding the consequences.   |
3460     +-----------------------------------------------------------------+
3461 Example usage (section):
3462
3463     # Crunch server headers that try to prevent caching
3464     { +crunch-server-header{no-cache} }
3465     /
3466
3467
3468 -------------------------------------------------------------------------------
3469
3470 8.5.10. crunch-outgoing-cookies
3471
3472 Typical use:
3473
3474     Prevent the web server from reading any HTTP cookies from your system
3475
3476 Effect:
3477
3478     Deletes any "Cookie:" HTTP headers from client requests.
3479
3480 Type:
3481
3482     Boolean.
3483
3484 Parameter:
3485
3486     N/A
3487
3488 Notes:
3489
3490     This action is only concerned with outgoing HTTP cookies. For incoming HTTP
3491     cookies, use crunch-incoming-cookies. Use both to disable HTTP cookies
3492     completely.
3493
3494     It makes no sense at all to use this action in conjunction with the
3495     session-cookies-only action, since it would prevent the session cookies
3496     from being read.
3497
3498 Example usage:
3499
3500     +crunch-outgoing-cookies
3501
3502
3503 -------------------------------------------------------------------------------
3504
3505 8.5.11. deanimate-gifs
3506
3507 Typical use:
3508
3509     Stop those annoying, distracting animated GIF images.
3510
3511 Effect:
3512
3513     De-animate GIF animations, i.e. reduce them to their first or last image.
3514
3515 Type:
3516
3517     Parameterized.
3518
3519 Parameter:
3520
3521     "last" or "first"
3522
3523 Notes:
3524
3525     This will also shrink the images considerably (in bytes, not pixels!). If
3526     the option "first" is given, the first frame of the animation is used as
3527     the replacement. If "last" is given, the last frame of the animation is
3528     used instead, which probably makes more sense for most banner animations,
3529     but also has the risk of not showing the entire last frame (if it is only a
3530     delta to an earlier frame).
3531
3532     You can safely use this action with patterns that will also match non-GIF
3533     objects, because no attempt will be made at anything that doesn't look like
3534     a GIF.
3535
3536 Example usage:
3537
3538     +deanimate-gifs{last}
3539
3540
3541 -------------------------------------------------------------------------------
3542
3543 8.5.12. downgrade-http-version
3544
3545 Typical use:
3546
3547     Work around (very rare) problems with HTTP/1.1
3548
3549 Effect:
3550
3551     Downgrades HTTP/1.1 client requests and server replies to HTTP/1.0.
3552
3553 Type:
3554
3555     Boolean.
3556
3557 Parameter:
3558
3559     N/A
3560
3561 Notes:
3562
3563     This is a left-over from the time when Privoxy didn't support important
3564     HTTP/1.1 features well. It is left here for the unlikely case that you
3565     experience HTTP/1.1 related problems with some server out there. Not all
3566     HTTP/1.1 features and requirements are supported yet, so there is a chance
3567     you might need this action.
3568
3569 Example usage (section):
3570
3571     {+downgrade-http-version}
3572     problem-host.example.com
3573
3574
3575 -------------------------------------------------------------------------------
3576
3577 8.5.13. fast-redirects
3578
3579 Typical use:
3580
3581     Fool some click-tracking scripts and speed up indirect links.
3582
3583 Effect:
3584
3585     Detects redirection URLs and redirects the browser without contacting the
3586     redirection server first.
3587
3588 Type:
3589
3590     Parameterized.
3591
3592 Parameter:
3593
3594       + "simple-check" to just search for the string "http://" to detect
3595         redirection URLs.
3596
3597       + "check-decoded-url" to decode URLs (if necessary) before searching for
3598         redirection URLs.
3599
3600 Notes:
3601
3602     Many sites, like yahoo.com, don't just link to other sites. Instead, they
3603     will link to some script on their own servers, giving the destination as a
3604     parameter, which will then redirect you to the final target. URLs resulting
3605     from this scheme typically look like: "http://www.example.org/
3606     click-tracker.cgi?target=http%3a//www.example.net/".
3607
3608     Sometimes, there are even multiple consecutive redirects encoded in the
3609     URL. These redirections via scripts make your web browsing more traceable,
3610     since the server from which you follow such a link can see where you go to.
3611     Apart from that, valuable bandwidth and time is wasted, while your browser
3612     asks the server for one redirect after the other. Plus, it feeds the
3613     advertisers.
3614
3615     This feature is currently not very smart and is scheduled for improvement.
3616     If it is enabled by default, you will have to create some exceptions to
3617     this action. It can lead to failures in several ways:
3618
3619     Not every URLs with other URLs as parameters is evil. Some sites offer a
3620     real service that requires this information to work. For example a
3621     validation service needs to know, which document to validate.
3622     fast-redirects assumes that every URL parameter that looks like another URL
3623     is a redirection target, and will always redirect to the last one. Most of
3624     the time the assumption is correct, but if it isn't, the user gets
3625     redirected anyway.
3626
3627     Another failure occurs if the URL contains other parameters after the URL
3628     parameter. The URL: "http://www.example.org/?redirect=http%3a//
3629     www.example.net/&foo=bar". contains the redirection URL "http://
3630     www.example.net/", followed by another parameter. fast-redirects doesn't
3631     know that and will cause a redirect to "http://www.example.net/&foo=bar".
3632     Depending on the target server configuration, the parameter will be
3633     silently ignored or lead to a "page not found" error. You can prevent this
3634     problem by first using the redirect action to remove the last part of the
3635     URL, but it requires a little effort.
3636
3637     To detect a redirection URL, fast-redirects only looks for the string
3638     "http://", either in plain text (invalid but often used) or encoded as
3639     "http%3a//". Some sites use their own URL encoding scheme, encrypt the
3640     address of the target server or replace it with a database id. In theses
3641     cases fast-redirects is fooled and the request reaches the redirection
3642     server where it probably gets logged.
3643
3644 Example usage:
3645
3646      { +fast-redirects{simple-check} }
3647        one.example.com
3648
3649      { +fast-redirects{check-decoded-url} }
3650        another.example.com/testing
3651
3652
3653 -------------------------------------------------------------------------------
3654
3655 8.5.14. filter
3656
3657 Typical use:
3658
3659     Get rid of HTML and JavaScript annoyances, banner advertisements (by size),
3660     do fun text replacements, add personalized effects, etc.
3661
3662 Effect:
3663
3664     All instances of text-based type, most notably HTML and JavaScript, to
3665     which this action applies, can be filtered on-the-fly through the specified
3666     regular expression based substitutions. (Note: as of version 3.0.3 plain
3667     text documents are exempted from filtering, because web servers often use
3668     the text/plain MIME type for all files whose type they don't know.)
3669
3670 Type:
3671
3672     Parameterized.
3673
3674 Parameter:
3675
3676     The name of a content filter, as defined in the filter file. Filters can be
3677     defined in one or more files as defined by the filterfile option in the
3678     config file. default.filter is the collection of filters supplied by the
3679     developers. Locally defined filters should go in their own file, such as
3680     user.filter.
3681
3682     When used in its negative form, and without parameters, all filtering is
3683     completely disabled.
3684
3685 Notes:
3686
3687     For your convenience, there are a number of pre-defined filters available
3688     in the distribution filter file that you can use. See the examples below
3689     for a list.
3690
3691     Filtering requires buffering the page content, which may appear to slow
3692     down page rendering since nothing is displayed until all content has passed
3693     the filters. (It does not really take longer, but seems that way since the
3694     page is not incrementally displayed.) This effect will be more noticeable
3695     on slower connections.
3696
3697     "Rolling your own" filters requires a knowledge of "Regular Expressions"
3698     and "HTML". This is very powerful feature, and potentially very intrusive.
3699     Filters should be used with caution, and where an equivalent "action" is
3700     not available.
3701
3702     The amount of data that can be filtered is limited to the buffer-limit
3703     option in the main config file. The default is 4096 KB (4 Megs). Once this
3704     limit is exceeded, the buffered data, and all pending data, is passed
3705     through unfiltered.
3706
3707     Inappropriate MIME types, such as zipped files, are not filtered at all.
3708     (Again, only text-based types except plain text). Encrypted SSL data (from
3709     HTTPS servers) cannot be filtered either, since this would violate the
3710     integrity of the secure transaction. In some situations it might be
3711     necessary to protect certain text, like source code, from filtering by
3712     defining appropriate -filter exceptions.
3713
3714     Compressed content can't be filtered either, unless Privoxy is compiled
3715     with zlib support (requires at least Privoxy 3.0.7), in which case Privoxy
3716     will decompress the content before filtering it.
3717
3718     If you use a Privoxy version without zlib support, but want filtering to
3719     work on as much documents as possible, even those that would normally be
3720     sent compressed, you must use the prevent-compression action in conjunction
3721     with filter.
3722
3723     Content filtering can achieve some of the same effects as the block action,
3724     i.e. it can be used to block ads and banners. But the mechanism works quite
3725     differently. One effective use, is to block ad banners based on their size
3726     (see below), since many of these seem to be somewhat standardized.
3727
3728     Feedback with suggestions for new or improved filters is particularly
3729     welcome!
3730
3731     The below list has only the names and a one-line description of each
3732     predefined filter. There are more verbose explanations of what these
3733     filters do in the filter file chapter.
3734
3735 Example usage (with filters from the distribution default.filter file). See the
3736     Predefined Filters section for more explanation on each:
3737
3738     +filter{js-annoyances}       # Get rid of particularly annoying JavaScript abuse
3739
3740
3741     +filter{js-events}           # Kill all JS event bindings (Radically destructive! Only for extra nasty sites)
3742
3743
3744     +filter{html-annoyances}     # Get rid of particularly annoying HTML abuse
3745
3746
3747     +filter{content-cookies}     # Kill cookies that come in the HTML or JS content
3748
3749
3750     +filter{refresh-tags}        # Kill automatic refresh tags (for dial-on-demand setups)
3751
3752
3753     +filter{unsolicited-popups}  # Disable only unsolicited pop-up windows. Useful if your browser lacks this ability.
3754
3755
3756     +filter{all-popups}          # Kill all popups in JavaScript and HTML. Useful if your browser lacks this ability.
3757
3758
3759     +filter{img-reorder}         # Reorder attributes in <img> tags to make the banners-by-* filters more effective
3760
3761
3762     +filter{banners-by-size}     # Kill banners by size
3763
3764
3765     +filter{banners-by-link}     # Kill banners by their links to known clicktrackers
3766
3767
3768     +filter{webbugs}             # Squish WebBugs (1x1 invisible GIFs used for user tracking)
3769
3770
3771     +filter{tiny-textforms}      # Extend those tiny textareas up to 40x80 and kill the hard wrap
3772
3773
3774     +filter{jumping-windows}     # Prevent windows from resizing and moving themselves
3775
3776
3777     +filter{frameset-borders}    # Give frames a border and make them resizeable
3778
3779
3780     +filter{demoronizer}         # Fix MS's non-standard use of standard charsets
3781
3782
3783     +filter{shockwave-flash}     # Kill embedded Shockwave Flash objects
3784
3785
3786     +filter{quicktime-kioskmode} # Make Quicktime movies savable
3787
3788
3789     +filter{fun}                 # Text replacements for subversive browsing fun!
3790
3791
3792     +filter{crude-parental}      # Crude parental filtering (demo only)
3793
3794
3795     +filter{ie-exploits}         # Disable a known Internet Explorer bug exploits
3796
3797
3798     +filter{site-specifics}      # Custom filters for specific site related problems
3799
3800
3801     +filter{google}              # Removes text ads and other Google specific improvements
3802
3803
3804     +filter{yahoo}               # Removes text ads and other Yahoo specific improvements
3805
3806
3807     +filter{msn}                 # Removes text ads and other MSN specific improvements
3808
3809
3810     +filter{blogspot}            # Cleans up Blogspot blogs
3811
3812
3813     +filter{no-ping}             # Removes non-standard ping attributes from anchor and area tags
3814
3815
3816 -------------------------------------------------------------------------------
3817
3818 8.5.15. force-text-mode
3819
3820 Typical use:
3821
3822     Force Privoxy to treat a document as if it was in some kind of text format.
3823
3824 Effect:
3825
3826     Declares a document as text, even if the "Content-Type:" isn't detected as
3827     such.
3828
3829 Type:
3830
3831     Boolean.
3832
3833 Parameter:
3834
3835     N/A
3836
3837 Notes:
3838
3839     As explained above, Privoxy tries to only filter files that are in some
3840     kind of text format. The same restrictions apply to content-type-overwrite.
3841     force-text-mode declares a document as text, without looking at the
3842     "Content-Type:" first.
3843
3844     +-----------------------------------------------------------------+
3845     |                             Warning                             |
3846     |-----------------------------------------------------------------|
3847     |Think twice before activating this action. Filtering binary data |
3848     |with regular expressions can cause file damage.                  |
3849     +-----------------------------------------------------------------+
3850 Example usage:
3851
3852     +force-text-mode
3853
3854
3855
3856 -------------------------------------------------------------------------------
3857
3858 8.5.16. forward-override
3859
3860 Typical use:
3861
3862     Change the forwarding settings based on User-Agent or request origin
3863
3864 Effect:
3865
3866     Overrules the forward directives in the configuration file.
3867
3868 Type:
3869
3870     Multi-value.
3871
3872 Parameter:
3873
3874       + "forward ." to use a direct connection without any additional proxies.
3875
3876       + "forward 127.0.0.1:8123" to use the HTTP proxy listening at 127.0.0.1
3877         port 8123.
3878
3879       + "forward-socks4a 127.0.0.1:9050 ." to use the socks4a proxy listening
3880         at 127.0.0.1 port 9050. Replace "forward-socks4a" with "forward-socks4"
3881         to use a socks4 connection (with local DNS resolution) instead.
3882
3883       + "forward-socks4a 127.0.0.1:9050 proxy.example.org:8000" to use the
3884         socks4a proxy listening at 127.0.0.1 port 9050 to reach the HTTP proxy
3885         listening at proxy.example.org port 8000. Replace "forward-socks4a"
3886         with "forward-socks4" to use a socks4 connection (with local DNS
3887         resolution) instead.
3888
3889 Notes:
3890
3891     This action takes parameters similar to the forward directives in the
3892     configuration file, but without the URL pattern. It can be used as
3893     replacement, but normally it's only used in cases where matching based on
3894     the request URL isn't sufficient.
3895
3896     +-----------------------------------------------------------------+
3897     |                             Warning                             |
3898     |-----------------------------------------------------------------|
3899     |Please read the description for the forward directives before    |
3900     |using this action. Forwarding to the wrong people will reduce    |
3901     |your privacy and increase the chances of man-in-the-middle       |
3902     |attacks.                                                         |
3903     |                                                                 |
3904     |If the ports are missing or invalid, default values will be used.|
3905     |This might change in the future and you shouldn't rely on it.    |
3906     |Otherwise incorrect syntax causes Privoxy to exit.               |
3907     |                                                                 |
3908     |Use the show-url-info CGI page to verify that your forward       |
3909     |settings do what you thought the do.                             |
3910     +-----------------------------------------------------------------+
3911 Example usage:
3912
3913     # Always use direct connections for requests previously tagged as
3914     # "User-Agent: fetch libfetch/2.0" and make sure
3915     # resuming downloads continues to work.
3916     # This way you can continue to use Tor for your normal browsing,
3917     # without overloading the Tor network with your FreeBSD ports updates
3918     # or downloads of bigger files like ISOs.
3919     # Note that HTTP headers are easy to fake and therefore their
3920     # values are as (un)trustworthy as your clients and users.
3921     {+forward-override{forward .} \
3922      -hide-if-modified-since      \
3923      -overwrite-last-modified     \
3924     }
3925     TAG:^User-Agent: fetch libfetch/2\.0$
3926
3927
3928
3929 -------------------------------------------------------------------------------
3930
3931 8.5.17. handle-as-empty-document
3932
3933 Typical use:
3934
3935     Mark URLs that should be replaced by empty documents if they get blocked
3936
3937 Effect:
3938
3939     This action alone doesn't do anything noticeable. It just marks URLs. If
3940     the block action also applies, the presence or absence of this mark decides
3941     whether an HTML "BLOCKED" page, or an empty document will be sent to the
3942     client as a substitute for the blocked content. The empty document isn't
3943     literally empty, but actually contains a single space.
3944
3945 Type:
3946
3947     Boolean.
3948
3949 Parameter:
3950
3951     N/A
3952
3953 Notes:
3954
3955     Some browsers complain about syntax errors if JavaScript documents are
3956     blocked with Privoxy's default HTML page; this option can be used to
3957     silence them. And of course this action can also be used to eliminate the
3958     Privoxy BLOCKED message in frames.
3959
3960     The content type for the empty document can be specified with
3961     content-type-overwrite{}, but usually this isn't necessary.
3962
3963 Example usage:
3964
3965     # Block all documents on example.org that end with ".js",
3966     # but send an empty document instead of the usual HTML message.
3967     {+block +handle-as-empty-document}
3968     example.org/.*\.js$
3969
3970
3971
3972 -------------------------------------------------------------------------------
3973
3974 8.5.18. handle-as-image
3975
3976 Typical use:
3977
3978     Mark URLs as belonging to images (so they'll be replaced by images if they
3979     do get blocked, rather than HTML pages)
3980
3981 Effect:
3982
3983     This action alone doesn't do anything noticeable. It just marks URLs as
3984     images. If the block action also applies, the presence or absence of this
3985     mark decides whether an HTML "blocked" page, or a replacement image (as
3986     determined by the set-image-blocker action) will be sent to the client as a
3987     substitute for the blocked content.
3988
3989 Type:
3990
3991     Boolean.
3992
3993 Parameter:
3994
3995     N/A
3996
3997 Notes:
3998
3999     The below generic example section is actually part of default.action. It
4000     marks all URLs with well-known image file name extensions as images and
4001     should be left intact.
4002
4003     Users will probably only want to use the handle-as-image action in
4004     conjunction with block, to block sources of banners, whose URLs don't
4005     reflect the file type, like in the second example section.
4006
4007     Note that you cannot treat HTML pages as images in most cases. For
4008     instance, (in-line) ad frames require an HTML page to be sent, or they
4009     won't display properly. Forcing handle-as-image in this situation will not
4010     replace the ad frame with an image, but lead to error messages.
4011
4012 Example usage (sections):
4013
4014     # Generic image extensions:
4015     #
4016     {+handle-as-image}
4017     /.*\.(gif|jpg|jpeg|png|bmp|ico)$
4018
4019     # These don't look like images, but they're banners and should be
4020     # blocked as images:
4021     #
4022     {+block +handle-as-image}
4023     some.nasty-banner-server.com/junk.cgi\?output=trash
4024
4025     # Banner source! Who cares if they also have non-image content?
4026     ad.doubleclick.net
4027
4028
4029 -------------------------------------------------------------------------------
4030
4031 8.5.19. hide-accept-language
4032
4033 Typical use:
4034
4035     Pretend to use different language settings.
4036
4037 Effect:
4038
4039     Deletes or replaces the "Accept-Language:" HTTP header in client requests.
4040
4041 Type:
4042
4043     Parameterized.
4044
4045 Parameter:
4046
4047     Keyword: "block", or any user defined value.
4048
4049 Notes:
4050
4051     Faking the browser's language settings can be useful to make a foreign
4052     User-Agent set with hide-user-agent more believable.
4053
4054     However some sites with content in different languages check the
4055     "Accept-Language:" to decide which one to take by default. Sometimes it
4056     isn't possible to later switch to another language without changing the
4057     "Accept-Language:" header first.
4058
4059     Therefore it's a good idea to either only change the "Accept-Language:"
4060     header to languages you understand, or to languages that aren't wide
4061     spread.
4062
4063     Before setting the "Accept-Language:" header to a rare language, you should
4064     consider that it helps to make your requests unique and thus easier to
4065     trace. If you don't plan to change this header frequently, you should stick
4066     to a common language.
4067
4068 Example usage (section):
4069
4070     # Pretend to use Canadian language settings.
4071     {+hide-accept-language{en-ca} \
4072     +hide-user-agent{Mozilla/5.0 (X11; U; OpenBSD i386; en-CA; rv:1.8.0.4) Gecko/20060628 Firefox/1.5.0.4} \
4073     }
4074     /
4075
4076
4077 -------------------------------------------------------------------------------
4078
4079 8.5.20. hide-content-disposition
4080
4081 Typical use:
4082
4083     Prevent download menus for content you prefer to view inside the browser.
4084
4085 Effect:
4086
4087     Deletes or replaces the "Content-Disposition:" HTTP header set by some
4088     servers.
4089
4090 Type:
4091
4092     Parameterized.
4093
4094 Parameter:
4095
4096     Keyword: "block", or any user defined value.
4097
4098 Notes:
4099
4100     Some servers set the "Content-Disposition:" HTTP header for documents they
4101     assume you want to save locally before viewing them. The
4102     "Content-Disposition:" header contains the file name the browser is
4103     supposed to use by default.
4104
4105     In most browsers that understand this header, it makes it impossible to
4106     just view the document, without downloading it first, even if it's just a
4107     simple text file or an image.
4108
4109     Removing the "Content-Disposition:" header helps to prevent this annoyance,
4110     but some browsers additionally check the "Content-Type:" header, before
4111     they decide if they can display a document without saving it first. In
4112     these cases, you have to change this header as well, before the browser
4113     stops displaying download menus.
4114
4115     It is also possible to change the server's file name suggestion to another
4116     one, but in most cases it isn't worth the time to set it up.
4117
4118     This action will probably be removed in the future, use server-header
4119     filters instead.
4120
4121 Example usage:
4122
4123     # Disarm the download link in Sourceforge's patch tracker
4124     { -filter \
4125      +content-type-overwrite{text/plain}\
4126      +hide-content-disposition{block} }
4127      .sourceforge.net/tracker/download\.php
4128
4129
4130 -------------------------------------------------------------------------------
4131
4132 8.5.21. hide-if-modified-since
4133
4134 Typical use:
4135
4136     Prevent yet another way to track the user's steps between sessions.
4137
4138 Effect:
4139
4140     Deletes the "If-Modified-Since:" HTTP client header or modifies its value.
4141
4142 Type:
4143
4144     Parameterized.
4145
4146 Parameter:
4147
4148     Keyword: "block", or a user defined value that specifies a range of hours.
4149
4150 Notes:
4151
4152     Removing this header is useful for filter testing, where you want to force
4153     a real reload instead of getting status code "304", which would cause the
4154     browser to use a cached copy of the page.
4155
4156     Instead of removing the header, hide-if-modified-since can also add or
4157     subtract a random amount of time to/from the header's value. You specify a
4158     range of minutes where the random factor should be chosen from and Privoxy
4159     does the rest. A negative value means subtracting, a positive value adding.
4160
4161     Randomizing the value of the "If-Modified-Since:" makes it less likely that
4162     the server can use the time as a cookie replacement, but you will run into
4163     caching problems if the random range is too high.
4164
4165     It is a good idea to only use a small negative value and let
4166     overwrite-last-modified handle the greater changes.
4167
4168     It is also recommended to use this action together with
4169     crunch-if-none-match, otherwise it's more or less pointless.
4170
4171 Example usage (section):
4172
4173     # Let the browser revalidate but make tracking based on the time less likely.
4174     {+hide-if-modified-since{-60} \
4175      +overwrite-last-modified{randomize} \
4176      +crunch-if-none-match}
4177     /
4178
4179
4180 -------------------------------------------------------------------------------
4181
4182 8.5.22. hide-forwarded-for-headers
4183
4184 Typical use:
4185
4186     Improve privacy by not forwarding the source of the request in the HTTP
4187     headers.
4188
4189 Effect:
4190
4191     Deletes any existing "X-Forwarded-for:" HTTP header from client requests.
4192
4193 Type:
4194
4195     Boolean.
4196
4197 Parameter:
4198
4199     N/A
4200
4201 Notes:
4202
4203     It is safe and recommended to leave this on.
4204
4205 Example usage:
4206
4207     +hide-forwarded-for-headers
4208
4209
4210 -------------------------------------------------------------------------------
4211
4212 8.5.23. hide-from-header
4213
4214 Typical use:
4215
4216     Keep your (old and ill) browser from telling web servers your email address
4217
4218 Effect:
4219
4220     Deletes any existing "From:" HTTP header, or replaces it with the specified
4221     string.
4222
4223 Type:
4224
4225     Parameterized.
4226
4227 Parameter:
4228
4229     Keyword: "block", or any user defined value.
4230
4231 Notes:
4232
4233     The keyword "block" will completely remove the header (not to be confused
4234     with the block action).
4235
4236     Alternately, you can specify any value you prefer to be sent to the web
4237     server. If you do, it is a matter of fairness not to use any address that
4238     is actually used by a real person.
4239
4240     This action is rarely needed, as modern web browsers don't send "From:"
4241     headers anymore.
4242
4243 Example usage:
4244
4245     +hide-from-header{block}
4246
4247
4248     or
4249
4250     +hide-from-header{spam-me-senseless@sittingduck.example.com}
4251
4252
4253 -------------------------------------------------------------------------------
4254
4255 8.5.24. hide-referrer
4256
4257 Typical use:
4258
4259     Conceal which link you followed to get to a particular site
4260
4261 Effect:
4262
4263     Deletes the "Referer:" (sic) HTTP header from the client request, or
4264     replaces it with a forged one.
4265
4266 Type:
4267
4268     Parameterized.
4269
4270 Parameter:
4271
4272       + "conditional-block" to delete the header completely if the host has
4273         changed.
4274
4275       + "conditional-forge" to forge the header if the host has changed.
4276
4277       + "block" to delete the header unconditionally.
4278
4279       + "forge" to pretend to be coming from the homepage of the server we are
4280         talking to.
4281
4282       + Any other string to set a user defined referrer.
4283
4284 Notes:
4285
4286     conditional-block is the only parameter, that isn't easily detected in the
4287     server's log file. If it blocks the referrer, the request will look like
4288     the visitor used a bookmark or typed in the address directly.
4289
4290     Leaving the referrer unmodified for requests on the same host allows the
4291     server owner to see the visitor's "click path", but in most cases she could
4292     also get that information by comparing other parts of the log file: for
4293     example the User-Agent if it isn't a very common one, or the user's IP
4294     address if it doesn't change between different requests.
4295
4296     Always blocking the referrer, or using a custom one, can lead to failures
4297     on servers that check the referrer before they answer any requests, in an
4298     attempt to prevent their content from being embedded or linked to
4299     elsewhere.
4300
4301     Both conditional-block and forge will work with referrer checks, as long as
4302     content and valid referring page are on the same host. Most of the time
4303     that's the case.
4304
4305     hide-referer is an alternate spelling of hide-referrer and the two can be
4306     can be freely substituted with each other. ("referrer" is the correct
4307     English spelling, however the HTTP specification has a bug - it requires it
4308     to be spelled as "referer".)
4309
4310 Example usage:
4311
4312     +hide-referrer{forge}
4313
4314
4315     or
4316
4317     +hide-referrer{http://www.yahoo.com/}
4318
4319
4320 -------------------------------------------------------------------------------
4321
4322 8.5.25. hide-user-agent
4323
4324 Typical use:
4325
4326     Try to conceal your type of browser and client operating system
4327
4328 Effect:
4329
4330     Replaces the value of the "User-Agent:" HTTP header in client requests with
4331     the specified value.
4332
4333 Type:
4334
4335     Parameterized.
4336
4337 Parameter:
4338
4339     Any user-defined string.
4340
4341 Notes:
4342
4343     +-----------------------------------------------------------------+
4344     |                             Warning                             |
4345     |-----------------------------------------------------------------|
4346     |This can lead to problems on web sites that depend on looking at |
4347     |this header in order to customize their content for different    |
4348     |browsers (which, by the way, is NOT the right thing to do: good  |
4349     |web sites work browser-independently).                           |
4350     +-----------------------------------------------------------------+
4351
4352     Using this action in multi-user setups or wherever different types of
4353     browsers will access the same Privoxy is not recommended. In single-user,
4354     single-browser setups, you might use it to delete your OS version
4355     information from the headers, because it is an invitation to exploit known
4356     bugs for your OS. It is also occasionally useful to forge this in order to
4357     access sites that won't let you in otherwise (though there may be a good
4358     reason in some cases). Example of this: some MSN sites will not let Mozilla
4359     enter, yet forging to a Netscape 6.1 user-agent works just fine. (Must be
4360     just a silly MS goof, I'm sure :-).
4361
4362     More information on known user-agent strings can be found at http://
4363     www.user-agents.org/ and http://en.wikipedia.org/wiki/User_agent.
4364
4365 Example usage:
4366
4367     +hide-user-agent{Netscape 6.1 (X11; I; Linux 2.4.18 i686)}
4368
4369
4370 -------------------------------------------------------------------------------
4371
4372 8.5.26. inspect-jpegs
4373
4374 Typical use:
4375
4376     Try to protect against a MS buffer over-run in JPEG processing
4377
4378 Effect:
4379
4380     Protect against a known exploit
4381
4382 Type:
4383
4384     Boolean.
4385
4386 Parameter:
4387
4388     N/A
4389
4390 Notes:
4391
4392     See Microsoft Security Bulletin MS04-028. JPEG images are one of the most
4393     common image types found across the Internet. The exploit as described can
4394     allow execution of code on the target system, giving an attacker access to
4395     the system in question by merely planting an altered JPEG image, which
4396     would have no obvious indications of what lurks inside. This action tries
4397     to prevent this exploit if delivered through unencrypted HTTP.
4398
4399     Note that the exploit mentioned is several years old and it's unlikely that
4400     your client is still vulnerable against it. This action may be removed in
4401     one of the next releases.
4402
4403 Example usage:
4404
4405     +inspect-jpegs
4406
4407
4408 -------------------------------------------------------------------------------
4409
4410 8.5.27. kill-popups
4411
4412 Typical use:
4413
4414     Eliminate those annoying pop-up windows (deprecated)
4415
4416 Effect:
4417
4418     While loading the document, replace JavaScript code that opens pop-up
4419     windows with (syntactically neutral) dummy code on the fly.
4420
4421 Type:
4422
4423     Boolean.
4424
4425 Parameter:
4426
4427     N/A
4428
4429 Notes:
4430
4431     This action is basically a built-in, hardwired special-purpose filter
4432     action, but there are important differences: For kill-popups, the document
4433     need not be buffered, so it can be incrementally rendered while
4434     downloading. But kill-popups doesn't catch as many pop-ups as filter
4435     {all-popups} does and is not as smart as filter{unsolicited-popups} is.
4436
4437     Think of it as a fast and efficient replacement for a filter that you can
4438     use if you don't want any filtering at all. Note that it doesn't make sense
4439     to combine it with any filter action, since as soon as one filter applies,
4440     the whole document needs to be buffered anyway, which destroys the
4441     advantage of the kill-popups action over its filter equivalent.
4442
4443     Killing all pop-ups unconditionally is problematic. Many shops and banks
4444     rely on pop-ups to display forms, shopping carts etc, and the filter
4445     {unsolicited-popups} does a better job of catching only the unwanted ones.
4446
4447     If the only kind of pop-ups that you want to kill are exit consoles (those
4448     really nasty windows that appear when you close an other one), you might
4449     want to use filter{js-annoyances} instead.
4450
4451     This action is most appropriate for browsers that don't have any controls
4452     for unwanted pop-ups. Not recommended for general usage.
4453
4454     This action doesn't work very reliable and may be removed in future
4455     releases.
4456
4457 Example usage:
4458
4459     +kill-popups
4460
4461
4462 -------------------------------------------------------------------------------
4463
4464 8.5.28. limit-connect
4465
4466 Typical use:
4467
4468     Prevent abuse of Privoxy as a TCP proxy relay or disable SSL for untrusted
4469     sites
4470
4471 Effect:
4472
4473     Specifies to which ports HTTP CONNECT requests are allowable.
4474
4475 Type:
4476
4477     Parameterized.
4478
4479 Parameter:
4480
4481     A comma-separated list of ports or port ranges (the latter using dashes,
4482     with the minimum defaulting to 0 and the maximum to 65K).
4483
4484 Notes:
4485
4486     By default, i.e. if no limit-connect action applies, Privoxy only allows
4487     HTTP CONNECT requests to port 443 (the standard, secure HTTPS port). Use
4488     limit-connect if more fine-grained control is desired for some or all
4489     destinations.
4490
4491     The CONNECT methods exists in HTTP to allow access to secure websites
4492     ("https://" URLs) through proxies. It works very simply: the proxy connects
4493     to the server on the specified port, and then short-circuits its
4494     connections to the client and to the remote server. This means
4495     CONNECT-enabled proxies can be used as TCP relays very easily.
4496
4497     Privoxy relays HTTPS traffic without seeing the decoded content. Websites
4498     can leverage this limitation to circumvent Privoxy's filters. By specifying
4499     an invalid port range you can disable HTTPS entirely. If you plan to
4500     disable SSL by default, consider enabling
4501     treat-forbidden-connects-like-blocks as well, to be able to quickly create
4502     exceptions.
4503
4504 Example usages:
4505
4506     +limit-connect{443}                   # This is the default and need not be specified.
4507     +limit-connect{80,443}                # Ports 80 and 443 are OK.
4508     +limit-connect{-3, 7, 20-100, 500-}   # Ports less than 3, 7, 20 to 100 and above 500 are OK.
4509     +limit-connect{-}                     # All ports are OK
4510     +limit-connect{,}                     # No HTTPS/SSL traffic is allowed
4511
4512
4513 -------------------------------------------------------------------------------
4514
4515 8.5.29. prevent-compression
4516
4517 Typical use:
4518
4519     Ensure that servers send the content uncompressed, so it can be passed
4520     through filters.
4521
4522 Effect:
4523
4524     Removes the Accept-Encoding header which can be used to ask for compressed
4525     transfer.
4526
4527 Type:
4528
4529     Boolean.
4530
4531 Parameter:
4532
4533     N/A
4534
4535 Notes:
4536
4537     More and more websites send their content compressed by default, which is
4538     generally a good idea and saves bandwidth. But the filter, deanimate-gifs
4539     and kill-popups actions need access to the uncompressed data.
4540
4541     When compiled with zlib support (available since Privoxy 3.0.7), content
4542     that should be filtered is decompressed on-the-fly and you don't have to
4543     worry about this action. If you are using an older Privoxy version, or one
4544     that hasn't been compiled with zlib support, this action can be used to
4545     convince the server to send the content uncompressed.
4546
4547     Most text-based instances compress very well, the size is seldom decreased
4548     by less than 50%, for markup-heavy instances like news feeds saving more
4549     than 90% of the original size isn't unusual.
4550
4551     Not using compression will therefore slow down the transfer, and you should
4552     only enable this action if you really need it. As of Privoxy 3.0.7 it's
4553     disabled in all predefined action settings.
4554
4555     Note that some (rare) ill-configured sites don't handle requests for
4556     uncompressed documents correctly. Broken PHP applications tend to send an
4557     empty document body, some IIS versions only send the beginning of the
4558     content. If you enable prevent-compression per default, you might want to
4559     add exceptions for those sites. See the example for how to do that.
4560
4561 Example usage (sections):
4562
4563     # Selectively turn off compression, and enable a filter
4564     #
4565     { +filter{tiny-textforms} +prevent-compression }
4566     # Match only these sites
4567      .google.
4568      sourceforge.net
4569      sf.net
4570
4571     # Or instead, we could set a universal default:
4572     #
4573     { +prevent-compression }
4574      / # Match all sites
4575
4576     # Then maybe make exceptions for broken sites:
4577     #
4578     { -prevent-compression }
4579     .compusa.com/
4580
4581
4582 -------------------------------------------------------------------------------
4583
4584 8.5.30. overwrite-last-modified
4585
4586 Typical use:
4587
4588     Prevent yet another way to track the user's steps between sessions.
4589
4590 Effect:
4591
4592     Deletes the "Last-Modified:" HTTP server header or modifies its value.
4593
4594 Type:
4595
4596     Parameterized.
4597
4598 Parameter:
4599
4600     One of the keywords: "block", "reset-to-request-time" and "randomize"
4601
4602 Notes:
4603
4604     Removing the "Last-Modified:" header is useful for filter testing, where
4605     you want to force a real reload instead of getting status code "304", which
4606     would cause the browser to reuse the old version of the page.
4607
4608     The "randomize" option overwrites the value of the "Last-Modified:" header
4609     with a randomly chosen time between the original value and the current
4610     time. In theory the server could send each document with a different
4611     "Last-Modified:" header to track visits without using cookies. "Randomize"
4612     makes it impossible and the browser can still revalidate cached documents.
4613
4614     "reset-to-request-time" overwrites the value of the "Last-Modified:" header
4615     with the current time. You could use this option together with
4616     hided-if-modified-since to further customize your random range.
4617
4618     The preferred parameter here is "randomize". It is safe to use, as long as
4619     the time settings are more or less correct. If the server sets the
4620     "Last-Modified:" header to the time of the request, the random range
4621     becomes zero and the value stays the same. Therefore you should later
4622     randomize it a second time with hided-if-modified-since, just to be sure.
4623
4624     It is also recommended to use this action together with
4625     crunch-if-none-match.
4626
4627 Example usage:
4628
4629     # Let the browser revalidate without being tracked across sessions
4630     { +hide-if-modified-since{-60} \
4631      +overwrite-last-modified{randomize} \
4632      +crunch-if-none-match}
4633     /
4634
4635
4636 -------------------------------------------------------------------------------
4637
4638 8.5.31. redirect
4639
4640 Typical use:
4641
4642     Redirect requests to other sites.
4643
4644 Effect:
4645
4646     Convinces the browser that the requested document has been moved to another
4647     location and the browser should get it from there.
4648
4649 Type:
4650
4651     Parameterized
4652
4653 Parameter:
4654
4655     An absolute URL or a single pcrs command.
4656
4657 Notes:
4658
4659     Requests to which this action applies are answered with a HTTP redirect to
4660     URLs of your choosing. The new URL is either provided as parameter, or
4661     derived by applying a single pcrs command to the original URL.
4662
4663     This action will be ignored if you use it together with block. It can be
4664     combined with fast-redirects{check-decoded-url} to redirect to a decoded
4665     version of a rewritten URL.
4666
4667     Use this action carefully, make sure not to create redirection loops and be
4668     aware that using your own redirects might make it possible to fingerprint
4669     your requests.
4670
4671 Example usages:
4672
4673     # Replace example.com's style sheet with another one
4674     { +redirect{http://localhost/css-replacements/example.com.css} }
4675      example.com/stylesheet\.css
4676
4677     # Create a short, easy to remember nickname for a favorite site
4678     # (relies on the browser accept and forward invalid URLs to Privoxy)
4679     { +redirect{http://www.privoxy.org/user-manual/actions-file.html} }
4680      a
4681
4682     # Always use the expanded view for Undeadly.org articles
4683     # (Note the $ at the end of the URL pattern to make sure
4684     # the request for the rewritten URL isn't redirected as well)
4685     {+redirect{s@$@&mode=expanded@}}
4686     undeadly.org/cgi\?action=article&sid=\d*$
4687
4688
4689 -------------------------------------------------------------------------------
4690
4691 8.5.32. send-vanilla-wafer
4692
4693 Typical use:
4694
4695     Feed log analysis scripts with useless data.
4696
4697 Effect:
4698
4699     Sends a cookie with each request stating that you do not accept any
4700     copyright on cookies sent to you, and asking the site operator not to track
4701     you.
4702
4703 Type:
4704
4705     Boolean.
4706
4707 Parameter:
4708
4709     N/A
4710
4711 Notes:
4712
4713     The vanilla wafer is a (relatively) unique header and could conceivably be
4714     used to track you.
4715
4716     This action is rarely used and not enabled in the default configuration.
4717
4718 Example usage:
4719
4720     +send-vanilla-wafer
4721
4722
4723 -------------------------------------------------------------------------------
4724
4725 8.5.33. send-wafer
4726
4727 Typical use:
4728
4729     Send custom cookies or feed log analysis scripts with even more useless
4730     data.
4731
4732 Effect:
4733
4734     Sends a custom, user-defined cookie with each request.
4735
4736 Type:
4737
4738     Multi-value.
4739
4740 Parameter:
4741
4742     A string of the form "name=value".
4743
4744 Notes:
4745
4746     Being multi-valued, multiple instances of this action can apply to the same
4747     request, resulting in multiple cookies being sent.
4748
4749     This action is rarely used and not enabled in the default configuration.
4750
4751 Example usage (section):
4752
4753     {+send-wafer{UsingPrivoxy=true}}
4754     my-internal-testing-server.void
4755
4756
4757 -------------------------------------------------------------------------------
4758
4759 8.5.34. server-header-filter
4760
4761 Typical use:
4762
4763     Rewrite or remove single server headers.
4764
4765 Effect:
4766
4767     All server headers to which this action applies are filtered on-the-fly
4768     through the specified regular expression based substitutions.
4769
4770 Type:
4771
4772     Parameterized.
4773
4774 Parameter:
4775
4776     The name of a server-header filter, as defined in one of the filter files.
4777
4778 Notes:
4779
4780     Server-header filters are applied to each header on its own, not to all at
4781     once. This makes it easier to diagnose problems, but on the downside you
4782     can't write filters that only change header x if header y's value is z. You
4783     can do that by using tags though.
4784
4785     Server-header filters are executed after the other header actions have
4786     finished and use their output as input.
4787
4788     Please refer to the filter file chapter to learn which server-header
4789     filters are available by default, and how to create your own.
4790
4791 Example usage (section):
4792
4793     {+server-header-filter{html-to-xml}}
4794     example.org/xml-instance-that-is-delivered-as-html
4795
4796     {+server-header-filter{xml-to-html}}
4797     example.org/instance-that-is-delivered-as-xml-but-is-not
4798
4799
4800
4801 -------------------------------------------------------------------------------
4802
4803 8.5.35. server-header-tagger
4804
4805 Typical use:
4806
4807     Enable or disable filters based on the Content-Type header.
4808
4809 Effect:
4810
4811     Server headers to which this action applies are filtered on-the-fly through
4812     the specified regular expression based substitutions, the result is used as
4813     tag.
4814
4815 Type:
4816
4817     Parameterized.
4818
4819 Parameter:
4820
4821     The name of a server-header tagger, as defined in one of the filter files.
4822
4823 Notes:
4824
4825     Server-header taggers are applied to each header on its own, and as the
4826     header isn't modified, each tagger "sees" the original.
4827
4828     Server-header taggers are executed before all other header actions that
4829     modify server headers. Their tags can be used to control all of the other
4830     server-header actions, the content filters and the crunch actions (redirect
4831     and block).
4832
4833     Obviously crunching based on tags created by server-header taggers doesn't
4834     prevent the request from showing up in the server's log file.
4835
4836 Example usage (section):
4837
4838     # Tag every request with the content type declared by the server
4839     {+server-header-tagger{content-type}}
4840     /
4841
4842
4843
4844 -------------------------------------------------------------------------------
4845
4846 8.5.36. session-cookies-only
4847
4848 Typical use:
4849
4850     Allow only temporary "session" cookies (for the current browser session
4851     only).
4852
4853 Effect:
4854
4855     Deletes the "expires" field from "Set-Cookie:" server headers. Most
4856     browsers will not store such cookies permanently and forget them in between
4857     sessions.
4858
4859 Type:
4860
4861     Boolean.
4862
4863 Parameter:
4864
4865     N/A
4866
4867 Notes:
4868
4869     This is less strict than crunch-incoming-cookies / crunch-outgoing-cookies
4870     and allows you to browse websites that insist or rely on setting cookies,
4871     without compromising your privacy too badly.
4872
4873     Most browsers will not permanently store cookies that have been processed
4874     by session-cookies-only and will forget about them between sessions. This
4875     makes profiling cookies useless, but won't break sites which require
4876     cookies so that you can log in for transactions. This is generally turned
4877     on for all sites, and is the recommended setting.
4878
4879     It makes no sense at all to use session-cookies-only together with
4880     crunch-incoming-cookies or crunch-outgoing-cookies. If you do, cookies will
4881     be plainly killed.
4882
4883     Note that it is up to the browser how it handles such cookies without an
4884     "expires" field. If you use an exotic browser, you might want to try it out
4885     to be sure.
4886
4887     This setting also has no effect on cookies that may have been stored
4888     previously by the browser before starting Privoxy. These would have to be
4889     removed manually.
4890
4891     Privoxy also uses the content-cookies filter to block some types of
4892     cookies. Content cookies are not effected by session-cookies-only.
4893
4894 Example usage:
4895
4896     +session-cookies-only
4897
4898
4899 -------------------------------------------------------------------------------
4900
4901 8.5.37. set-image-blocker
4902
4903 Typical use:
4904
4905     Choose the replacement for blocked images
4906
4907 Effect:
4908
4909     This action alone doesn't do anything noticeable. If both block and
4910     handle-as-image also apply, i.e. if the request is to be blocked as an
4911     image, then the parameter of this action decides what will be sent as a
4912     replacement.
4913
4914 Type:
4915
4916     Parameterized.
4917
4918 Parameter:
4919
4920       + "pattern" to send a built-in checkerboard pattern image. The image is
4921         visually decent, scales very well, and makes it obvious where banners
4922         were busted.
4923
4924       + "blank" to send a built-in transparent image. This makes banners
4925         disappear completely, but makes it hard to detect where Privoxy has
4926         blocked images on a given page and complicates troubleshooting if
4927         Privoxy has blocked innocent images, like navigation icons.
4928
4929       + "target-url" to send a redirect to target-url. You can redirect to any
4930         image anywhere, even in your local filesystem via "file:///" URL. (But
4931         note that not all browsers support redirecting to a local file system).
4932
4933         A good application of redirects is to use special Privoxy-built-in
4934         URLs, which send the built-in images, as target-url. This has the same
4935         visual effect as specifying "blank" or "pattern" in the first place,
4936         but enables your browser to cache the replacement image, instead of
4937         requesting it over and over again.
4938
4939 Notes:
4940
4941     The URLs for the built-in images are "http://config.privoxy.org/
4942     send-banner?type=type", where type is either "blank" or "pattern".
4943
4944     There is a third (advanced) type, called "auto". It is NOT to be used in
4945     set-image-blocker, but meant for use from filters. Auto will select the
4946     type of image that would have applied to the referring page, had it been an
4947     image.
4948
4949 Example usage:
4950
4951     Built-in pattern:
4952
4953     +set-image-blocker{pattern}
4954
4955
4956     Redirect to the BSD daemon:
4957
4958     +set-image-blocker{http://www.freebsd.org/gifs/dae_up3.gif}
4959
4960
4961     Redirect to the built-in pattern for better caching:
4962
4963     +set-image-blocker{http://config.privoxy.org/send-banner?type=pattern}
4964
4965
4966 -------------------------------------------------------------------------------
4967
4968 8.5.38. treat-forbidden-connects-like-blocks
4969
4970 Typical use:
4971
4972     Block forbidden connects with an easy to find error message.
4973
4974 Effect:
4975
4976     If this action is enabled, Privoxy no longer makes a difference between
4977     forbidden connects and ordinary blocks.
4978
4979 Type:
4980
4981     Boolean
4982
4983 Parameter:
4984
4985     N/A
4986
4987 Notes:
4988
4989     By default Privoxy answers forbidden "Connect" requests with a short error
4990     message inside the headers. If the browser doesn't display headers (most
4991     don't), you just see an empty page.
4992
4993     With this action enabled, Privoxy displays the message that is used for
4994     ordinary blocks instead. If you decide to make an exception for the page in
4995     question, you can do so by following the "See why" link.
4996
4997     For "Connect" requests the clients tell Privoxy which host they are
4998     interested in, but not which document they plan to get later. As a result,
4999     the "Go there anyway" wouldn't work and is therefore suppressed.
5000
5001 Example usage:
5002
5003     +treat-forbidden-connects-like-blocks
5004
5005
5006 -------------------------------------------------------------------------------
5007
5008 8.5.39. Summary
5009
5010 Note that many of these actions have the potential to cause a page to
5011 misbehave, possibly even not to display at all. There are many ways a site
5012 designer may choose to design his site, and what HTTP header content, and other
5013 criteria, he may depend on. There is no way to have hard and fast rules for all
5014 sites. See the Appendix for a brief example on troubleshooting actions.
5015
5016 -------------------------------------------------------------------------------
5017
5018 8.6. Aliases
5019
5020 Custom "actions", known to Privoxy as "aliases", can be defined by combining
5021 other actions. These can in turn be invoked just like the built-in actions.
5022 Currently, an alias name can contain any character except space, tab, "=", "{"
5023 and "}", but we strongly recommend that you only use "a" to "z", "0" to "9",
5024 "+", and "-". Alias names are not case sensitive, and are not required to start
5025 with a "+" or "-" sign, since they are merely textually expanded.
5026
5027 Aliases can be used throughout the actions file, but they must be defined in a
5028 special section at the top of the file! And there can only be one such section
5029 per actions file. Each actions file may have its own alias section, and the
5030 aliases defined in it are only visible within that file.
5031
5032 There are two main reasons to use aliases: One is to save typing for frequently
5033 used combinations of actions, the other one is a gain in flexibility: If you
5034 decide once how you want to handle shops by defining an alias called "shop",
5035 you can later change your policy on shops in one place, and your changes will
5036 take effect everywhere in the actions file where the "shop" alias is used.
5037 Calling aliases by their purpose also makes your actions files more readable.
5038
5039 Currently, there is one big drawback to using aliases, though: Privoxy's
5040 built-in web-based action file editor honors aliases when reading the actions
5041 files, but it expands them before writing. So the effects of your aliases are
5042 of course preserved, but the aliases themselves are lost when you edit sections
5043 that use aliases with it.
5044
5045 Now let's define some aliases...
5046
5047  # Useful custom aliases we can use later.
5048  #
5049  # Note the (required!) section header line and that this section
5050  # must be at the top of the actions file!
5051  #
5052  {{alias}}
5053
5054  # These aliases just save typing later:
5055  # (Note that some already use other aliases!)
5056  #
5057  +crunch-all-cookies = +crunch-incoming-cookies +crunch-outgoing-cookies
5058  -crunch-all-cookies = -crunch-incoming-cookies -crunch-outgoing-cookies
5059  +block-as-image      = +block +handle-as-image
5060  allow-all-cookies   = -crunch-all-cookies -session-cookies-only -filter{content-cookies}
5061
5062  # These aliases define combinations of actions
5063  # that are useful for certain types of sites:
5064  #
5065  fragile     = -block -filter -crunch-all-cookies -fast-redirects -hide-referrer -kill-popups -prevent-compression
5066
5067  shop        = -crunch-all-cookies -filter{all-popups} -kill-popups
5068
5069  # Short names for other aliases, for really lazy people ;-)
5070  #
5071  c0 = +crunch-all-cookies
5072  c1 = -crunch-all-cookies
5073
5074
5075 ...and put them to use. These sections would appear in the lower part of an
5076 actions file and define exceptions to the default actions (as specified further
5077 up for the "/" pattern):
5078
5079  # These sites are either very complex or very keen on
5080  # user data and require minimal interference to work:
5081  #
5082  {fragile}
5083  .office.microsoft.com
5084  .windowsupdate.microsoft.com
5085  # Gmail is really mail.google.com, not gmail.com
5086  mail.google.com
5087
5088  # Shopping sites:
5089  # Allow cookies (for setting and retrieving your customer data)
5090  #
5091  {shop}
5092  .quietpc.com
5093  .worldpay.com   # for quietpc.com
5094  mybank.example.com
5095
5096  # These shops require pop-ups:
5097  #
5098  {-kill-popups -filter{all-popups} -filter{unsolicited-popups}}
5099   .dabs.com
5100   .overclockers.co.uk
5101
5102
5103 Aliases like "shop" and "fragile" are typically used for "problem" sites that
5104 require more than one action to be disabled in order to function properly.
5105
5106 -------------------------------------------------------------------------------
5107
5108 8.7. Actions Files Tutorial
5109
5110 The above chapters have shown which actions files there are and how they are
5111 organized, how actions are specified and applied to URLs, how patterns work,
5112 and how to define and use aliases. Now, let's look at an example default.action
5113 and user.action file and see how all these pieces come together:
5114
5115 -------------------------------------------------------------------------------
5116
5117 8.7.1. default.action
5118
5119 Every config file should start with a short comment stating its purpose:
5120
5121 # Sample default.action file <ijbswa-developers@lists.sourceforge.net>
5122
5123
5124 Then, since this is the default.action file, the first section is a special
5125 section for internal use that you needn't change or worry about:
5126
5127 ##########################################################################
5128 # Settings -- Don't change! For internal Privoxy use ONLY.
5129 ##########################################################################
5130
5131 {{settings}}
5132 for-privoxy-version=3.0
5133
5134
5135 After that comes the (optional) alias section. We'll use the example section
5136 from the above chapter on aliases, that also explains why and how aliases are
5137 used:
5138
5139 ##########################################################################
5140 # Aliases
5141 ##########################################################################
5142 {{alias}}
5143
5144  # These aliases just save typing later:
5145  # (Note that some already use other aliases!)
5146  #
5147  +crunch-all-cookies = +crunch-incoming-cookies +crunch-outgoing-cookies
5148  -crunch-all-cookies = -crunch-incoming-cookies -crunch-outgoing-cookies
5149  +block-as-image      = +block +handle-as-image
5150  mercy-for-cookies   = -crunch-all-cookies -session-cookies-only -filter{content-cookies}
5151
5152  # These aliases define combinations of actions
5153  # that are useful for certain types of sites:
5154  #
5155  fragile     = -block -filter -crunch-all-cookies -fast-redirects -hide-referrer -kill-popups
5156  shop        = -crunch-all-cookies -filter{all-popups} -kill-popups
5157
5158
5159 Now come the regular sections, i.e. sets of actions, accompanied by URL
5160 patterns to which they apply. Remember all actions are disabled when matching
5161 starts, so we have to explicitly enable the ones we want.
5162
5163 The first regular section is probably the most important. It has only one
5164 pattern, "/", but this pattern matches all URLs. Therefore, the set of actions
5165 used in this "default" section will be applied to all requests as a start. It
5166 can be partly or wholly overridden by later matches further down this file, or
5167 in user.action, but it will still be largely responsible for your overall
5168 browsing experience.
5169
5170 Again, at the start of matching, all actions are disabled, so there is no need
5171 to disable any actions here. (Remember: a "+" preceding the action name enables
5172 the action, a "-" disables!). Also note how this long line has been made more
5173 readable by splitting it into multiple lines with line continuation.
5174
5175 ##########################################################################
5176 # "Defaults" section:
5177 ##########################################################################
5178  { \
5179  +deanimate-gifs \
5180  +filter{html-annoyances} \
5181  +filter{refresh-tags} \
5182  +filter{webbugs} \
5183  +filter{ie-exploits} \
5184  +hide-forwarded-for-headers \
5185  +hide-from-header{block} \
5186  +hide-referrer{forge} \
5187  +prevent-compression \
5188  +session-cookies-only \
5189  +set-image-blocker{pattern} \
5190  }
5191  / # forward slash will match *all* potential URL patterns.
5192
5193
5194 The default behavior is now set.
5195
5196 The first of our specialized sections is concerned with "fragile" sites, i.e.
5197 sites that require minimum interference, because they are either very complex
5198 or very keen on tracking you (and have mechanisms in place that make them
5199 unusable for people who avoid being tracked). We will simply use our
5200 pre-defined fragile alias instead of stating the list of actions explicitly:
5201
5202 ##########################################################################
5203 # Exceptions for sites that'll break under the default action set:
5204 ##########################################################################
5205
5206 # "Fragile" Use a minimum set of actions for these sites (see alias above):
5207 #
5208 { fragile }
5209 .office.microsoft.com           # surprise, surprise!
5210 .windowsupdate.microsoft.com
5211 mail.google.com
5212
5213
5214 Shopping sites are not as fragile, but they typically require cookies to log
5215 in, and pop-up windows for shopping carts or item details. Again, we'll use a
5216 pre-defined alias:
5217
5218 # Shopping sites:
5219 #
5220 { shop }
5221 .quietpc.com
5222 .worldpay.com   # for quietpc.com
5223 .jungle.com
5224 .scan.co.uk
5225
5226
5227 The fast-redirects action, which we enabled per default above, breaks some
5228 sites. So disable it for popular sites where we know it misbehaves:
5229
5230 { -fast-redirects }
5231 login.yahoo.com
5232 edit.*.yahoo.com
5233 .google.com
5234 .altavista.com/.*(like|url|link):http
5235 .altavista.com/trans.*urltext=http
5236 .nytimes.com
5237
5238
5239 It is important that Privoxy knows which URLs belong to images, so that if they
5240 are to be blocked, a substitute image can be sent, rather than an HTML page.
5241 Contacting the remote site to find out is not an option, since it would destroy
5242 the loading time advantage of banner blocking, and it would feed the
5243 advertisers (in terms of money and information). We can mark any URL as an
5244 image with the handle-as-image action, and marking all URLs that end in a known
5245 image file extension is a good start:
5246
5247 ##########################################################################
5248 # Images:
5249 ##########################################################################
5250
5251 # Define which file types will be treated as images, in case they get
5252 # blocked further down this file:
5253 #
5254 { +handle-as-image }
5255 /.*\.(gif|jpe?g|png|bmp|ico)$
5256
5257
5258 And then there are known banner sources. They often use scripts to generate the
5259 banners, so it won't be visible from the URL that the request is for an image.
5260 Hence we block them and mark them as images in one go, with the help of our
5261 +block-as-image alias defined above. (We could of course just as well use +
5262 block +handle-as-image here.) Remember that the type of the replacement image
5263 is chosen by the set-image-blocker action. Since all URLs have matched the
5264 default section with its +set-image-blocker{pattern} action before, it still
5265 applies and needn't be repeated:
5266
5267 # Known ad generators:
5268 #
5269 { +block-as-image }
5270 ar.atwola.com
5271 .ad.doubleclick.net
5272 .ad.*.doubleclick.net
5273 .a.yimg.com/(?:(?!/i/).)*$
5274 .a[0-9].yimg.com/(?:(?!/i/).)*$
5275 bs*.gsanet.com
5276 .qkimg.net
5277
5278
5279 One of the most important jobs of Privoxy is to block banners. Many of these
5280 can be "blocked" by the filter{banners-by-size} action, which we enabled above,
5281 and which deletes the references to banner images from the pages while they are
5282 loaded, so the browser doesn't request them anymore, and hence they don't need
5283 to be blocked here. But this naturally doesn't catch all banners, and some
5284 people choose not to use filters, so we need a comprehensive list of patterns
5285 for banner URLs here, and apply the block action to them.
5286
5287 First comes many generic patterns, which do most of the work, by matching
5288 typical domain and path name components of banners. Then comes a list of
5289 individual patterns for specific sites, which is omitted here to keep the
5290 example short:
5291
5292 ##########################################################################
5293 # Block these fine banners:
5294 ##########################################################################
5295 { +block }
5296
5297 # Generic patterns:
5298 #
5299 ad*.
5300 .*ads.
5301 banner?.
5302 count*.
5303 /.*count(er)?\.(pl|cgi|exe|dll|asp|php[34]?)
5304 /(?:.*/)?(publicite|werbung|rekla(ma|me|am)|annonse|maino(kset|nta|s)?)/
5305
5306 # Site-specific patterns (abbreviated):
5307 #
5308 .hitbox.com
5309
5310
5311 It's quite remarkable how many advertisers actually call their banner servers
5312 ads.company.com, or call the directory in which the banners are stored simply
5313 "banners". So the above generic patterns are surprisingly effective.
5314
5315 But being very generic, they necessarily also catch URLs that we don't want to
5316 block. The pattern .*ads. e.g. catches "nasty-ads.nasty-corp.com" as intended,
5317 but also "downloads.sourcefroge.net" or "adsl.some-provider.net." So here come
5318 some well-known exceptions to the +block section above.
5319
5320 Note that these are exceptions to exceptions from the default! Consider the URL
5321 "downloads.sourcefroge.net": Initially, all actions are deactivated, so it
5322 wouldn't get blocked. Then comes the defaults section, which matches the URL,
5323 but just deactivates the block action once again. Then it matches .*ads., an
5324 exception to the general non-blocking policy, and suddenly +block applies. And
5325 now, it'll match .*loads., where -block applies, so (unless it matches again
5326 further down) it ends up with no block action applying.
5327
5328 ##########################################################################
5329 # Save some innocent victims of the above generic block patterns:
5330 ##########################################################################
5331
5332 # By domain:
5333 #
5334 { -block }
5335 adv[io]*.  # (for advogato.org and advice.*)
5336 adsl.      # (has nothing to do with ads)
5337 adobe.     # (has nothing to do with ads either)
5338 ad[ud]*.   # (adult.* and add.*)
5339 .edu       # (universities don't host banners (yet!))
5340 .*loads.   # (downloads, uploads etc)
5341
5342 # By path:
5343 #
5344 /.*loads/
5345
5346 # Site-specific:
5347 #
5348 www.globalintersec.com/adv # (adv = advanced)
5349 www.ugu.com/sui/ugu/adv
5350
5351
5352 Filtering source code can have nasty side effects, so make an exception for our
5353 friends at sourceforge.net, and all paths with "cvs" in them. Note that -filter
5354 disables all filters in one fell swoop!
5355
5356 # Don't filter code!
5357 #
5358 { -filter }
5359 /(.*/)?cvs
5360 bugzilla.
5361 developer.
5362 wiki.
5363 .sourceforge.net
5364
5365
5366 The actual default.action is of course much more comprehensive, but we hope
5367 this example made clear how it works.
5368
5369 -------------------------------------------------------------------------------
5370
5371 8.7.2. user.action
5372
5373 So far we are painting with a broad brush by setting general policies, which
5374 would be a reasonable starting point for many people. Now, you might want to be
5375 more specific and have customized rules that are more suitable to your personal
5376 habits and preferences. These would be for narrowly defined situations like
5377 your ISP or your bank, and should be placed in user.action, which is parsed
5378 after all other actions files and hence has the last word, over-riding any
5379 previously defined actions. user.action is also a safe place for your personal
5380 settings, since default.action is actively maintained by the Privoxy developers
5381 and you'll probably want to install updated versions from time to time.
5382
5383 So let's look at a few examples of things that one might typically do in
5384 user.action:
5385
5386 # My user.action file. <fred@example.com>
5387
5388
5389 As aliases are local to the actions file that they are defined in, you can't
5390 use the ones from default.action, unless you repeat them here:
5391
5392 # Aliases are local to the file they are defined in.
5393 # (Re-)define aliases for this file:
5394 #
5395 {{alias}}
5396 #
5397 # These aliases just save typing later, and the alias names should
5398 # be self explanatory.
5399 #
5400 +crunch-all-cookies = +crunch-incoming-cookies +crunch-outgoing-cookies
5401 -crunch-all-cookies = -crunch-incoming-cookies -crunch-outgoing-cookies
5402  allow-all-cookies  = -crunch-all-cookies -session-cookies-only
5403  allow-popups       = -filter{all-popups} -kill-popups
5404 +block-as-image     = +block +handle-as-image
5405 -block-as-image     = -block
5406
5407 # These aliases define combinations of actions that are useful for
5408 # certain types of sites:
5409 #
5410 fragile     = -block -crunch-all-cookies -filter -fast-redirects -hide-referrer -kill-popups
5411 shop        = -crunch-all-cookies allow-popups
5412
5413 # Allow ads for selected useful free sites:
5414 #
5415 allow-ads   = -block -filter{banners-by-size} -filter{banners-by-link}
5416
5417 # Alias for specific file types that are text, but might have conflicting
5418 # MIME types. We want the browser to force these to be text documents.
5419 handle-as-text = -filter +-content-type-overwrite{text/plain} +-force-text-mode -hide-content-disposition
5420
5421
5422  
5423
5424 Say you have accounts on some sites that you visit regularly, and you don't
5425 want to have to log in manually each time. So you'd like to allow persistent
5426 cookies for these sites. The allow-all-cookies alias defined above does exactly
5427 that, i.e. it disables crunching of cookies in any direction, and the
5428 processing of cookies to make them only temporary.
5429
5430 { allow-all-cookies }
5431  sourceforge.net
5432  .yahoo.com
5433  .msdn.microsoft.com
5434  .redhat.com
5435
5436
5437 Your bank is allergic to some filter, but you don't know which, so you disable
5438 them all:
5439
5440 { -filter }
5441  .your-home-banking-site.com
5442
5443
5444 Some file types you may not want to filter for various reasons:
5445
5446 # Technical documentation is likely to contain strings that might
5447 # erroneously get altered by the JavaScript-oriented filters:
5448 #
5449 .tldp.org
5450 /(.*/)?selfhtml/
5451
5452 # And this stupid host sends streaming video with a wrong MIME type,
5453 # so that Privoxy thinks it is getting HTML and starts filtering:
5454 #
5455 stupid-server.example.com/
5456
5457
5458 Example of a simple block action. Say you've seen an ad on your favourite page
5459 on example.com that you want to get rid of. You have right-clicked the image,
5460 selected "copy image location" and pasted the URL below while removing the
5461 leading http://, into a { +block } section. Note that { +handle-as-image } need
5462 not be specified, since all URLs ending in .gif will be tagged as images by the
5463 general rules as set in default.action anyway:
5464
5465 { +block }
5466  www.example.com/nasty-ads/sponsor\.gif
5467  another.example.net/more/junk/here/
5468
5469
5470 The URLs of dynamically generated banners, especially from large banner farms,
5471 often don't use the well-known image file name extensions, which makes it
5472 impossible for Privoxy to guess the file type just by looking at the URL. You
5473 can use the +block-as-image alias defined above for these cases. Note that
5474 objects which match this rule but then turn out NOT to be an image are
5475 typically rendered as a "broken image" icon by the browser. Use cautiously.
5476
5477 { +block-as-image }
5478  .doubleclick.net
5479  .fastclick.net
5480  /Realmedia/ads/
5481  ar.atwola.com/
5482
5483
5484 Now you noticed that the default configuration breaks Forbes Magazine, but you
5485 were too lazy to find out which action is the culprit, and you were again too
5486 lazy to give feedback, so you just used the fragile alias on the site, and --
5487 whoa! -- it worked. The fragile aliases disables those actions that are most
5488 likely to break a site. Also, good for testing purposes to see if it is Privoxy
5489 that is causing the problem or not. We later find other regular sites that
5490 misbehave, and add those to our personalized list of troublemakers:
5491
5492 { fragile }
5493  .forbes.com
5494  webmail.example.com
5495  .mybank.com
5496
5497
5498 You like the "fun" text replacements in default.filter, but it is disabled in
5499 the distributed actions file. So you'd like to turn it on in your private,
5500 update-safe config, once and for all:
5501
5502 { +filter{fun} }
5503  / # For ALL sites!
5504
5505
5506 Note that the above is not really a good idea: There are exceptions to the
5507 filters in default.action for things that really shouldn't be filtered, like
5508 code on CVS->Web interfaces. Since user.action has the last word, these
5509 exceptions won't be valid for the "fun" filtering specified here.
5510
5511 You might also worry about how your favourite free websites are funded, and
5512 find that they rely on displaying banner advertisements to survive. So you
5513 might want to specifically allow banners for those sites that you feel provide
5514 value to you:
5515
5516 { allow-ads }
5517  .sourceforge.net
5518  .slashdot.org
5519  .osdn.net
5520
5521
5522 Note that allow-ads has been aliased to -block, -filter{banners-by-size}, and -
5523 filter{banners-by-link} above.
5524
5525 Invoke another alias here to force an over-ride of the MIME type application/
5526 x-sh which typically would open a download type dialog. In my case, I want to
5527 look at the shell script, and then I can save it should I choose to.
5528
5529 { handle-as-text }
5530  /.*\.sh$
5531
5532
5533 user.action is generally the best place to define exceptions and additions to
5534 the default policies of default.action. Some actions are safe to have their
5535 default policies set here though. So let's set a default policy to have a
5536 "blank" image as opposed to the checkerboard pattern for ALL sites. "/" of
5537 course matches all URL paths and patterns:
5538
5539 { +set-image-blocker{blank} }
5540 / # ALL sites
5541
5542
5543 -------------------------------------------------------------------------------
5544
5545 9. Filter Files
5546
5547 On-the-fly text substitutions need to be defined in a "filter file". Once
5548 defined, they can then be invoked as an "action".
5549
5550 Privoxy supports three different filter actions: filter to rewrite the content
5551 that is send to the client, client-header-filter to rewrite headers that are
5552 send by the client, and server-header-filter to rewrite headers that are send
5553 by the server.
5554
5555 Privoxy also supports two tagger actions: client-header-tagger and
5556 server-header-tagger. Taggers and filters use the same syntax in the filter
5557 files, the difference is that taggers don't modify the text they are filtering,
5558 but use a rewritten version of the filtered text as tag. The tags can then be
5559 used to change the applying actions through sections with tag-patterns.
5560
5561 Multiple filter files can be defined through the filterfile config directive.
5562 The filters as supplied by the developers are located in default.filter. It is
5563 recommended that any locally defined or modified filters go in a separately
5564 defined file such as user.filter.
5565
5566 Common tasks for content filters are to eliminate common annoyances in HTML and
5567 JavaScript, such as pop-up windows, exit consoles, crippled windows without
5568 navigation tools, the infamous <BLINK> tag etc, to suppress images with certain
5569 width and height attributes (standard banner sizes or web-bugs), or just to
5570 have fun.
5571
5572 Enabled content filters are applied to any content whose "Content Type" header
5573 is recognised as a sign of text-based content, with the exception of text/
5574 plain. Use the force-text-mode action to also filter other content.
5575
5576 Substitutions are made at the source level, so if you want to "roll your own"
5577 filters, you should first be familiar with HTML syntax, and, of course, regular
5578 expressions.
5579
5580 Just like the actions files, the filter file is organized in sections, which
5581 are called filters here. Each filter consists of a heading line, that starts
5582 with one of the keywords FILTER:, CLIENT-HEADER-FILTER: or
5583 SERVER-HEADER-FILTER: followed by the filter's name, and a short (one line)
5584 description of what it does. Below that line come the jobs, i.e. lines that
5585 define the actual text substitutions. By convention, the name of a filter
5586 should describe what the filter eliminates. The comment is used in the
5587 web-based user interface.
5588
5589 Once a filter called name has been defined in the filter file, it can be
5590 invoked by using an action of the form +filter{name} in any actions file.
5591
5592 Filter definitions start with a header line that contains the filter type, the
5593 filter name and the filter description. A content filter header line for a
5594 filter called "foo" could look like this:
5595
5596 FILTER: foo Replace all "foo" with "bar"
5597
5598
5599 Below that line, and up to the next header line, come the jobs that define what
5600 text replacements the filter executes. They are specified in a syntax that
5601 imitates Perl's s/// operator. If you are familiar with Perl, you will find
5602 this to be quite intuitive, and may want to look at the PCRS documentation for
5603 the subtle differences to Perl behaviour. Most notably, the non-standard option
5604 letter U is supported, which turns the default to ungreedy matching.
5605
5606 If you are new to "Regular Expressions", you might want to take a look at the
5607 Appendix on regular expressions, and see the Perl manual for the s///
5608 operator's syntax and Perl-style regular expressions in general. The below
5609 examples might also help to get you started.
5610
5611 -------------------------------------------------------------------------------
5612
5613 9.1. Filter File Tutorial
5614
5615 Now, let's complete our "foo" content filter. We have already defined the
5616 heading, but the jobs are still missing. Since all it does is to replace "foo"
5617 with "bar", there is only one (trivial) job needed:
5618
5619 s/foo/bar/
5620
5621
5622 But wait! Didn't the comment say that all occurrences of "foo" should be
5623 replaced? Our current job will only take care of the first "foo" on each page.
5624 For global substitution, we'll need to add the g option:
5625
5626 s/foo/bar/g
5627
5628
5629 Our complete filter now looks like this:
5630
5631 FILTER: foo Replace all "foo" with "bar"
5632 s/foo/bar/g
5633
5634
5635 Let's look at some real filters for more interesting examples. Here you see a
5636 filter that protects against some common annoyances that arise from JavaScript
5637 abuse. Let's look at its jobs one after the other:
5638
5639 FILTER: js-annoyances Get rid of particularly annoying JavaScript abuse
5640
5641 # Get rid of JavaScript referrer tracking. Test page: http://www.randomoddness.com/untitled.htm
5642 #
5643 s|(<script.*)document\.referrer(.*</script>)|$1"Not Your Business!"$2|Usg
5644
5645
5646 Following the header line and a comment, you see the job. Note that it uses |
5647 as the delimiter instead of /, because the pattern contains a forward slash,
5648 which would otherwise have to be escaped by a backslash (\).
5649
5650 Now, let's examine the pattern: it starts with the text <script.* enclosed in
5651 parentheses. Since the dot matches any character, and * means: "Match an
5652 arbitrary number of the element left of myself", this matches "<script",
5653 followed by any text, i.e. it matches the whole page, from the start of the
5654 first <script> tag.
5655
5656 That's more than we want, but the pattern continues: document\.referrer matches
5657 only the exact string "document.referrer". The dot needed to be escaped, i.e.
5658 preceded by a backslash, to take away its special meaning as a joker, and make
5659 it just a regular dot. So far, the meaning is: Match from the start of the
5660 first <script> tag in a the page, up to, and including, the text
5661 "document.referrer", if both are present in the page (and appear in that
5662 order).
5663
5664 But there's still more pattern to go. The next element, again enclosed in
5665 parentheses, is .*</script>. You already know what .* means, so the whole
5666 pattern translates to: Match from the start of the first <script> tag in a page
5667 to the end of the last <script> tag, provided that the text "document.referrer"
5668 appears somewhere in between.
5669
5670 This is still not the whole story, since we have ignored the options and the
5671 parentheses: The portions of the page matched by sub-patterns that are enclosed
5672 in parentheses, will be remembered and be available through the variables $1,
5673 $2, ... in the substitute. The U option switches to ungreedy matching, which
5674 means that the first .* in the pattern will only "eat up" all text in between "
5675 <script" and the first occurrence of "document.referrer", and that the second
5676 .* will only span the text up to the first "</script>" tag. Furthermore, the s
5677 option says that the match may span multiple lines in the page, and the g
5678 option again means that the substitution is global.
5679
5680 So, to summarize, the pattern means: Match all scripts that contain the text
5681 "document.referrer". Remember the parts of the script from (and including) the
5682 start tag up to (and excluding) the string "document.referrer" as $1, and the
5683 part following that string, up to and including the closing tag, as $2.
5684
5685 Now the pattern is deciphered, but wasn't this about substituting things? So
5686 lets look at the substitute: $1"Not Your Business!"$2 is easy to read: The text
5687 remembered as $1, followed by "Not Your Business!" (including the quotation
5688 marks!), followed by the text remembered as $2. This produces an exact copy of
5689 the original string, with the middle part (the "document.referrer") replaced by
5690 "Not Your Business!".
5691
5692 The whole job now reads: Replace "document.referrer" by "Not Your Business!"
5693 wherever it appears inside a <script> tag. Note that this job won't break
5694 JavaScript syntax, since both the original and the replacement are
5695 syntactically valid string objects. The script just won't have access to the
5696 referrer information anymore.
5697
5698 We'll show you two other jobs from the JavaScript taming department, but this
5699 time only point out the constructs of special interest:
5700
5701 # The status bar is for displaying link targets, not pointless blahblah
5702 #
5703 s/window\.status\s*=\s*(['"]).*?\1/dUmMy=1/ig
5704
5705
5706 \s stands for whitespace characters (space, tab, newline, carriage return, form
5707 feed), so that \s* means: "zero or more whitespace". The ? in .*? makes this
5708 matching of arbitrary text ungreedy. (Note that the U option is not set). The
5709 ['"] construct means: "a single or a double quote". Finally, \1 is a
5710 back-reference to the first parenthesis just like $1 above, with the difference
5711 that in the pattern, a backslash indicates a back-reference, whereas in the
5712 substitute, it's the dollar.
5713
5714 So what does this job do? It replaces assignments of single- or double-quoted
5715 strings to the "window.status" object with a dummy assignment (using a variable
5716 name that is hopefully odd enough not to conflict with real variables in
5717 scripts). Thus, it catches many cases where e.g. pointless descriptions are
5718 displayed in the status bar instead of the link target when you move your mouse
5719 over links.
5720
5721 # Kill OnUnload popups. Yummy. Test: http://www.zdnet.com/zdsubs/yahoo/tree/yfs.html
5722 #
5723 s/(<body [^>]*)onunload(.*>)/$1never$2/iU
5724
5725
5726 Including the OnUnload event binding in the HTML DOM was a CRIME. When I close
5727 a browser window, I want it to close and die. Basta. This job replaces the
5728 "onunload" attribute in "<body>" tags with the dummy word never. Note that the
5729 i option makes the pattern matching case-insensitive. Also note that ungreedy
5730 matching alone doesn't always guarantee a minimal match: In the first
5731 parenthesis, we had to use [^>]* instead of .* to prevent the match from
5732 exceeding the <body> tag if it doesn't contain "OnUnload", but the page's
5733 content does.
5734
5735 The last example is from the fun department:
5736
5737 FILTER: fun Fun text replacements
5738
5739 # Spice the daily news:
5740 #
5741 s/microsoft(?!\.com)/MicroSuck/ig
5742
5743
5744 Note the (?!\.com) part (a so-called negative lookahead) in the job's pattern,
5745 which means: Don't match, if the string ".com" appears directly following
5746 "microsoft" in the page. This prevents links to microsoft.com from being
5747 trashed, while still replacing the word everywhere else.
5748
5749 # Buzzword Bingo (example for extended regex syntax)
5750 #
5751 s* industry[ -]leading \
5752 |  cutting[ -]edge \
5753 |  customer[ -]focused \
5754 |  market[ -]driven \
5755 |  award[ -]winning # Comments are OK, too! \
5756 |  high[ -]performance \
5757 |  solutions[ -]based \
5758 |  unmatched \
5759 |  unparalleled \
5760 |  unrivalled \
5761 *<font color="red"><b>BINGO!</b></font> \
5762 *igx
5763
5764
5765 The x option in this job turns on extended syntax, and allows for e.g. the
5766 liberal use of (non-interpreted!) whitespace for nicer formatting.
5767
5768 You get the idea?
5769
5770 -------------------------------------------------------------------------------
5771
5772 9.2. The Pre-defined Filters
5773
5774 The distribution default.filter file contains a selection of pre-defined
5775 filters for your convenience:
5776
5777 js-annoyances
5778
5779     The purpose of this filter is to get rid of particularly annoying
5780     JavaScript abuse. To that end, it
5781
5782       + replaces JavaScript references to the browser's referrer information
5783         with the string "Not Your Business!". This compliments the
5784         hide-referrer action on the content level.
5785
5786       + removes the bindings to the DOM's unload event which we feel has no
5787         right to exist and is responsible for most "exit consoles", i.e. nasty
5788         windows that pop up when you close another one.
5789
5790       + removes code that causes new windows to be opened with undesired
5791         properties, such as being full-screen, non-resizeable, without
5792         location, status or menu bar etc.
5793
5794     Use with caution. This is an aggressive filter, and can break sites that
5795     rely heavily on JavaScript.
5796
5797 js-events
5798
5799     This is a very radical measure. It removes virtually all JavaScript event
5800     bindings, which means that scripts can not react to user actions such as
5801     mouse movements or clicks, window resizing etc, anymore. Use with caution!
5802
5803     We strongly discourage using this filter as a default since it breaks many
5804     legitimate scripts. It is meant for use only on extra-nasty sites (should
5805     you really need to go there).
5806
5807 html-annoyances
5808
5809     This filter will undo many common instances of HTML based abuse.
5810
5811     The BLINK and MARQUEE tags are neutralized (yeah baby!), and browser
5812     windows will be created as resizeable (as of course they should be!), and
5813     will have location, scroll and menu bars -- even if specified otherwise.
5814
5815 content-cookies
5816
5817     Most cookies are set in the HTTP dialog, where they can be intercepted by
5818     the crunch-incoming-cookies and crunch-outgoing-cookies actions. But web
5819     sites increasingly make use of HTML meta tags and JavaScript to sneak
5820     cookies to the browser on the content level.
5821
5822     This filter disables most HTML and JavaScript code that reads or sets
5823     cookies. It cannot detect all clever uses of these types of code, so it
5824     should not be relied on as an absolute fix. Use it wherever you would also
5825     use the cookie crunch actions.
5826
5827 refresh tags
5828
5829     Disable any refresh tags if the interval is greater than nine seconds (so
5830     that redirections done via refresh tags are not destroyed). This is useful
5831     for dial-on-demand setups, or for those who find this HTML feature
5832     annoying.
5833
5834 unsolicited-popups
5835
5836     This filter attempts to prevent only "unsolicited" pop-up windows from
5837     opening, yet still allow pop-up windows that the user has explicitly chosen
5838     to open. It was added in version 3.0.1, as an improvement over earlier such
5839     filters.
5840
5841     Technical note: The filter works by redefining the window.open JavaScript
5842     function to a dummy function, PrivoxyWindowOpen(), during the loading and
5843     rendering phase of each HTML page access, and restoring the function
5844     afterward.
5845
5846     This is recommended only for browsers that cannot perform this function
5847     reliably themselves. And be aware that some sites require such windows in
5848     order to function normally. Use with caution.
5849
5850 all-popups
5851
5852     Attempt to prevent all pop-up windows from opening. Note this should be
5853     used with even more discretion than the above, since it is more likely to
5854     break some sites that require pop-ups for normal usage. Use with caution.
5855
5856 img-reorder
5857
5858     This is a helper filter that has no value if used alone. It makes the
5859     banners-by-size and banners-by-link (see below) filters more effective and
5860     should be enabled together with them.
5861
5862 banners-by-size
5863
5864     This filter removes image tags purely based on what size they are.
5865     Fortunately for us, many ads and banner images tend to conform to certain
5866     standardized sizes, which makes this filter quite effective for ad
5867     stripping purposes.
5868
5869     Occasionally this filter will cause false positives on images that are not
5870     ads, but just happen to be of one of the standard banner sizes.
5871
5872     Recommended only for those who require extreme ad blocking. The default
5873     block rules should catch 95+% of all ads without this filter enabled.
5874
5875 banners-by-link
5876
5877     This is an experimental filter that attempts to kill any banners if their
5878     URLs seem to point to known or suspected click trackers. It is currently
5879     not of much value and is not recommended for use by default.
5880
5881 webbugs
5882
5883     Webbugs are small, invisible images (technically 1X1 GIF images), that are
5884     used to track users across websites, and collect information on them. As an
5885     HTML page is loaded by the browser, an embedded image tag causes the
5886     browser to contact a third-party site, disclosing the tracking information
5887     through the requested URL and/or cookies for that third-party domain,
5888     without the user ever becoming aware of the interaction with the
5889     third-party site. HTML-ized spam also uses a similar technique to verify
5890     email addresses.
5891
5892     This filter removes the HTML code that loads such "webbugs".
5893
5894 tiny-textforms
5895
5896     A rather special-purpose filter that can be used to enlarge textareas
5897     (those multi-line text boxes in web forms) and turn off hard word wrap in
5898     them. It was written for the sourceforge.net tracker system where such
5899     boxes are a nuisance, but it can be handy on other sites, too.
5900
5901     It is not recommended to use this filter as a default.
5902
5903 jumping-windows
5904
5905     Many consider windows that move, or resize themselves to be abusive. This
5906     filter neutralizes the related JavaScript code. Note that some sites might
5907     not display or behave as intended when using this filter. Use with caution.
5908
5909 frameset-borders
5910
5911     Some web designers seem to assume that everyone in the world will view
5912     their web sites using the same browser brand and version, screen resolution
5913     etc, because only that assumption could explain why they'd use static frame
5914     sizes, yet prevent their frames from being resized by the user, should they
5915     be too small to show their whole content.
5916
5917     This filter removes the related HTML code. It should only be applied to
5918     sites which need it.
5919
5920 demoronizer
5921
5922     Many Microsoft products that generate HTML use non-standard extensions
5923     (read: violations) of the ISO 8859-1 aka Latin-1 character set. This can
5924     cause those HTML documents to display with errors on standard-compliant
5925     platforms.
5926
5927     This filter translates the MS-only characters into Latin-1 equivalents. It
5928     is not necessary when using MS products, and will cause corruption of all
5929     documents that use 8-bit character sets other than Latin-1. It's mostly
5930     worthwhile for Europeans on non-MS platforms, if weird garbage characters
5931     sometimes appear on some pages, or user agents that don't correct for this
5932     on the fly.
5933
5934 shockwave-flash
5935
5936     A filter for shockwave haters. As the name suggests, this filter strips
5937     code out of web pages that is used to embed shockwave flash objects.
5938
5939 quicktime-kioskmode
5940
5941     Change HTML code that embeds Quicktime objects so that kioskmode, which
5942     prevents saving, is disabled.
5943
5944 fun
5945
5946     Text replacements for subversive browsing fun. Make fun of your favorite
5947     Monopolist or play buzzword bingo.
5948
5949 crude-parental
5950
5951     A demonstration-only filter that shows how Privoxy can be used to delete
5952     web content on a keyword basis.
5953
5954 ie-exploits
5955
5956     An experimental collection of text replacements to disable malicious HTML
5957     and JavaScript code that exploits known security holes in Internet
5958     Explorer.
5959
5960     Presently, it only protects against Nimda and a cross-site scripting bug,
5961     and would need active maintenance to provide more substantial protection.
5962
5963 site-specifics
5964
5965     Some web sites have very specific problems, the cure for which doesn't
5966     apply anywhere else, or could even cause damage on other sites.
5967
5968     This is a collection of such site-specific cures which should only be
5969     applied to the sites they were intended for, which is what the supplied
5970     default.action file does. Users shouldn't need to change anything regarding
5971     this filter.
5972
5973 google
5974
5975     A CSS based block for Google text ads. Also removes a width limitation and
5976     the toolbar advertisement.
5977
5978 yahoo
5979
5980     Another CSS based block, this time for Yahoo text ads. And removes a width
5981     limitation as well.
5982
5983 msn
5984
5985     Another CSS based block, this time for MSN text ads. And removes tracking
5986     URLs, as well as a width limitation.
5987
5988 blogspot
5989
5990     Cleans up some Blogspot blogs. Read the fine print before using this one!
5991
5992     This filter also intentionally removes some navigation stuff and sets the
5993     page width to 100%. As a result, some rounded "corners" would appear to
5994     early or not at all and as fixing this would require a browser that
5995     understands background-size (CSS3), they are removed instead.
5996
5997 xml-to-html
5998
5999     Server-header filter to change the Content-Type from xml to html.
6000
6001 html-to-xml
6002
6003     Server-header filter to change the Content-Type from html to xml.
6004
6005 no-ping
6006
6007     Removes the non-standard ping attribute from anchor and area HTML tags.
6008
6009 hide-tor-exit-notation
6010
6011     Client-header filter to remove the Tor exit node notation found in Host and
6012     Referer headers.
6013
6014     If Privoxy and Tor are chained and Privoxy is configured to use socks4a,
6015     one can use "http://www.example.org.foobar.exit/" to access the host
6016     "www.example.org" through the Tor exit node "foobar".
6017
6018     As the HTTP client isn't aware of this notation, it treats the whole string
6019     "www.example.org.foobar.exit" as host and uses it for the "Host" and
6020     "Referer" headers. From the server's point of view the resulting headers
6021     are invalid and can cause problems.
6022
6023     An invalid "Referer" header can trigger "hot-linking" protections, an
6024     invalid "Host" header will make it impossible for the server to find the
6025     right vhost (several domains hosted on the same IP address).
6026
6027     This client-header filter removes the "foo.exit" part in those headers to
6028     prevent the mentioned problems. Note that it only modifies the HTTP
6029     headers, it doesn't make it impossible for the server to detect your Tor
6030     exit node based on the IP address the request is coming from.
6031
6032 -------------------------------------------------------------------------------
6033
6034 10. Privoxy's Template Files
6035
6036 All Privoxy built-in pages, i.e. error pages such as the "404 - No Such Domain"
6037 error page, the "BLOCKED" page and all pages of its web-based user interface,
6038 are generated from templates. (Privoxy must be running for the above links to
6039 work as intended.)
6040
6041 These templates are stored in a subdirectory of the configuration directory
6042 called templates. On Unixish platforms, this is typically /etc/privoxy/
6043 templates/.
6044
6045 The templates are basically normal HTML files, but with place-holders (called
6046 symbols or exports), which Privoxy fills at run time. It is possible to edit
6047 the templates with a normal text editor, should you want to customize them.
6048 (Not recommended for the casual user). Should you create your own custom
6049 templates, you should use the config setting templdir to specify an alternate
6050 location, so your templates do not get overwritten during upgrades.
6051
6052 Note that just like in configuration files, lines starting with # are ignored
6053 when the templates are filled in.
6054
6055 The place-holders are of the form @name@, and you will find a list of available
6056 symbols, which vary from template to template, in the comments at the start of
6057 each file. Note that these comments are not always accurate, and that it's
6058 probably best to look at the existing HTML code to find out which symbols are
6059 supported and what they are filled in with.
6060
6061 A special application of this substitution mechanism is to make whole blocks of
6062 HTML code disappear when a specific symbol is set. We use this for many
6063 purposes, one of them being to include the beta warning in all our user
6064 interface (CGI) pages when Privoxy is in an alpha or beta development stage:
6065
6066 <!-- @if-unstable-start -->
6067
6068   ... beta warning HTML code goes here ...
6069
6070 <!-- if-unstable-end@ -->
6071
6072
6073 If the "unstable" symbol is set, everything in between and including
6074 @if-unstable-start and if-unstable-end@ will disappear, leaving nothing but an
6075 empty comment:
6076
6077 <!--  -->
6078
6079
6080 There's also an if-then-else construct and an #include mechanism, but you'll
6081 sure find out if you are inclined to edit the templates ;-)
6082
6083 All templates refer to a style located at http://config.privoxy.org/
6084 send-stylesheet. This is, of course, locally served by Privoxy and the source
6085 for it can be found and edited in the cgi-style.css template.
6086
6087 -------------------------------------------------------------------------------
6088
6089 11. Contacting the Developers, Bug Reporting and Feature Requests
6090
6091 We value your feedback. In fact, we rely on it to improve Privoxy and its
6092 configuration. However, please note the following hints, so we can provide you
6093 with the best support:
6094
6095 -------------------------------------------------------------------------------
6096
6097 11.1. Get Support
6098
6099 For casual users, our support forum at SourceForge is probably best suited:
6100 http://sourceforge.net/tracker/?group_id=11118&atid=211118
6101
6102 All users are of course welcome to discuss their issues on the users mailing
6103 list, where the developers also hang around.
6104
6105 Note that the Privoxy mailing lists are moderated. Posts from unsubscribed
6106 addresses have to be accepted manually by a moderator. This may cause a delay
6107 of several days and if you use a subject that doesn't clearly mention Privoxy
6108 or one of its features, your message may be accidentally discarded as spam.
6109
6110 If you aren't subscribed, you should therefore spend a few seconds to come up
6111 with a proper subject. Additionally you should make it clear that you want to
6112 get CC'd. Otherwise some responses will be directed to the mailing list only,
6113 and you won't see them.
6114
6115 -------------------------------------------------------------------------------
6116
6117 11.2. Reporting Problems
6118
6119 "Problems" for our purposes, come in two forms:
6120
6121   * Configuration issues, such as ads that slip through, or sites that don't
6122     function properly due to one Privoxy "action" or another being turned "on".
6123
6124   * "Bugs" in the programming code that makes up Privoxy, such as that might
6125     cause a crash.
6126
6127 -------------------------------------------------------------------------------
6128
6129 11.2.1. Reporting Ads or Other Configuration Problems
6130
6131 Please send feedback on ads that slipped through, innocent images that were
6132 blocked, sites that don't work properly, and other configuration related
6133 problem of default.action file, to http://sourceforge.net/tracker/?group_id=
6134 11118&atid=460288, the Actions File Tracker.
6135
6136 New, improved default.action files may occasionally be made available based on
6137 your feedback. These will be announced on the ijbswa-announce list and
6138 available from our the files section of our project page.
6139
6140 -------------------------------------------------------------------------------
6141
6142 11.2.2. Reporting Bugs
6143
6144 Please report all bugs through our bug tracker: http://sourceforge.net/tracker
6145 /?group_id=11118&atid=111118.
6146
6147 Before doing so, please make sure that the bug has not already been submitted
6148 and observe the additional hints at the top of the submit form. If already
6149 submitted, please feel free to add any info to the original report that might
6150 help to solve the issue.
6151
6152 Please try to verify that it is a Privoxy bug, and not a browser or site bug or
6153 documented behaviour that just happens to be different than what you expected.
6154 If unsure, try toggling off Privoxy, and see if the problem persists.
6155
6156 If you are using your own custom configuration, please try the stock configs to
6157 see if the problem is configuration related. If you're having problems with a
6158 feature that is disabled by default, please ask around on the mailing list if
6159 others can reproduce the problem.
6160
6161 If you aren't using the latest Privoxy version, the bug may have been found and
6162 fixed in the meantime. We would appreciate if you could take the time to
6163 upgrade to the latest version (or even the latest CVS snapshot) and verify that
6164 your bug still exists.
6165
6166 Please be sure to provide the following information:
6167
6168   * The exact Privoxy version you are using (if you got the source from CVS,
6169     please also provide the source code revisions as shown in http://
6170     config.privoxy.org/show-version).
6171
6172   * The operating system and versions you run Privoxy on, (e.g. Windows XP
6173     SP2), if you are using a Unix flavor, sending the output of "uname -a"
6174     should do, in case of GNU/Linux, please also name the distribution.
6175
6176   * The name, platform, and version of the browser you were using (e.g.
6177     Internet Explorer v5.5 for Mac).
6178
6179   * The URL where the problem occurred, or some way for us to duplicate the
6180     problem (e.g. http://somesite.example.com/?somethingelse=123).
6181
6182   * Whether your version of Privoxy is one supplied by the Privoxy developers
6183     via SourceForge, or if you got your copy somewhere else.
6184
6185   * Whether you are using Privoxy in tandem with another proxy such as Tor. If
6186     so, please temporary disable the other proxy to see if the symptoms change.
6187
6188   * Whether you are using a personal firewall product. If so, does Privoxy work
6189     without it?
6190
6191   * Any other pertinent information to help identify the problem such as config
6192     or log file excerpts (yes, you should have log file entries for each action
6193     taken).
6194
6195 You don't have to tell us your actual name when filing a problem report, but
6196 please use a nickname so we can differentiate between your messages and the
6197 ones entered by other "anonymous" users that may respond to your request if
6198 they have the same problem or already found a solution.
6199
6200 Please also check the status of your request a few days after submitting it, as
6201 we may request additional information. If you use a SF id, you should
6202 automatically get a mail when someone responds to your request.
6203
6204 The appendix of the Privoxy User Manual also has helpful information on
6205 understanding actions, and action debugging.
6206
6207 -------------------------------------------------------------------------------
6208
6209 11.3. Request New Features
6210
6211 You are welcome to submit ideas on new features or other proposals for
6212 improvement through our feature request tracker at http://sourceforge.net/
6213 tracker/?atid=361118&group_id=11118.
6214
6215 -------------------------------------------------------------------------------
6216
6217 11.4. Other
6218
6219 For any other issues, feel free to use the mailing lists. Technically
6220 interested users and people who wish to contribute to the project are also
6221 welcome on the developers list! You can find an overview of all Privoxy-related
6222 mailing lists, including list archives, at: http://sourceforge.net/mail/?
6223 group_id=11118.
6224
6225 -------------------------------------------------------------------------------
6226
6227 12. Privoxy Copyright, License and History
6228
6229 Copyright   2001-2007 by Privoxy Developers <
6230 ijbswa-developers@lists.sourceforge.net>
6231
6232 Some source code is based on code Copyright   1997 by Anonymous Coders and
6233 Junkbusters, Inc. and licensed under the GNU General Public License.
6234
6235 -------------------------------------------------------------------------------
6236
6237 12.1. License
6238
6239 Privoxy is free software; you can redistribute it and/or modify it under the
6240 terms of the GNU General Public License, version 2, as published by the Free
6241 Software Foundation.
6242
6243 This program is distributed in the hope that it will be useful, but WITHOUT ANY
6244 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
6245 PARTICULAR PURPOSE. See the GNU General Public License for more details, which
6246 is available from the Free Software Foundation, Inc, 51 Franklin Street, Fifth
6247 Floor, Boston, MA 02110-1301, USA
6248
6249 You should have received a copy of the GNU General Public License along with
6250 this program; if not, write to the
6251
6252  Free Software
6253  Foundation, Inc. 51 Franklin Street, Fifth Floor
6254  Boston, MA 02110-1301
6255  USA 
6256
6257 -------------------------------------------------------------------------------
6258
6259 12.2. History
6260
6261 A long time ago, there was the Internet Junkbuster, by Anonymous Coders and
6262 Junkbusters Corporation. This saved many users a lot of pain in the early days
6263 of web advertising and user tracking.
6264
6265 But the web, its protocols and standards, and with it, the techniques for
6266 forcing ads on users, give up autonomy over their browsing, and for tracking
6267 them, keeps evolving. Unfortunately, the Internet Junkbuster did not. Version
6268 2.0.2, published in 1998, was (and is) the last official release available from
6269 Junkbusters Corporation. Fortunately, it had been released under the GNU GPL,
6270 which allowed further development by others.
6271
6272 So Stefan Waldherr started maintaining an improved version of the software, to
6273 which eventually a number of people contributed patches. It could already
6274 replace banners with a transparent image, and had a first version of pop-up
6275 killing, but it was still very closely based on the original, with all its
6276 limitations, such as the lack of HTTP/1.1 support, flexible per-site
6277 configuration, or content modification. The last release from this effort was
6278 version 2.0.2-10, published in 2000.
6279
6280 Then, some developers picked up the thread, and started turning the software
6281 inside out, upside down, and then reassembled it, adding many new features
6282 along the way.
6283
6284 The result of this is Privoxy, whose first stable version, 3.0, was released
6285 August, 2002.
6286
6287 -------------------------------------------------------------------------------
6288
6289 12.3. Authors
6290
6291 Current Privoxy Team:
6292
6293  Fabian Keil, lead developer
6294  David Schmidt, developer
6295  
6296  Hal Burgiss
6297  Gerry Murphy
6298  Roland Rosenfeld
6299  J rg Strohmayer
6300
6301 Former Privoxy Team Members:
6302
6303  Johny Agotnes 
6304  Rodrigo Barbosa
6305  Moritz Barsnick
6306  Ian Cummings
6307  Brian Dessent
6308  Jon Foster
6309  Karsten Hopp
6310  Alexander Lazic
6311  Daniel Leite
6312  G bor Lipt k
6313  Adam Lock
6314  Guy Laroche
6315  Mark Martinec 
6316  Justin McMurtry
6317  Andreas Oesterhelt
6318  Haroon Rafique
6319  Georg Sauthoff
6320  Thomas Steudten
6321  Rodney Stromlund
6322  Sviatoslav Sviridov
6323  Sarantis Paskalis
6324  Stefan Waldherr
6325
6326 Thanks to the many people who have tested Privoxy, reported bugs, provided
6327 patches, made suggestions or contributed in some way. These include (in
6328 alphabetical order):
6329
6330  Ken Arromdee
6331  Devin Bayer
6332  Gergely Bor
6333  Reiner Buehl
6334  Andrew J. Caines
6335  Clifford Caoile
6336  Fr d ric Crozat
6337  Michael T. Davis
6338  Mattes Dolak 
6339  Peter E.
6340  Florian Effenberger
6341  Markus Elfring
6342  Dean Gaudet
6343  Stephen Gildea
6344  Daniel Griscom
6345  Felix Gr bert
6346  Aaron Hamid
6347  Darel Henman
6348  Magnus Holmgren
6349  Ralf Horstmann
6350  Stefan Huehner 
6351  Peter Hyman
6352  Derek Jennings
6353  Petr Kadlec
6354  David Laight
6355  Bert van Leeuwen
6356  Don Libes  
6357  Paul Lieverse
6358  Toby Lyward
6359  Wil Mahan
6360  Jindrich Makovicka 
6361  David Mediavilla 
6362  Raphael Moll
6363  Amuro Namie
6364  Adam Piggott
6365  Dan Price
6366  Lee R.
6367  Roberto Ragusa
6368  F lix Rauch
6369  Maynard Riley
6370  Chung-chieh Shan
6371  Spinor S.
6372  Bart Schelstraete
6373  Oliver Stoeneberg
6374  Peter Thoenen
6375  Martin Thomas
6376  Song Weijia
6377  J rg Weinmann 
6378  Darren Wiebe
6379  Bobby G. Vinyard
6380  Anduin Withers
6381  Oliver Yeoh
6382  Jamie Zawinski
6383
6384 Privoxy is based in part on code originally developed by Junkbusters Corp. and
6385 Anonymous Coders.
6386
6387 Privoxy heavily relies on Philip Hazel's PCRE.
6388
6389 The code to filter compressed content makes use of zlib which is written by
6390 Jean-loup Gailly and Mark Adler.
6391
6392 On systems that lack snprintf(), Privoxy is using a version written by Mark
6393 Martinec. On systems that lack strptime(), Privoxy is using the one from the
6394 GNU C Library written by Ulrich Drepper.
6395
6396 -------------------------------------------------------------------------------
6397
6398 13. See Also
6399
6400 Other references and sites of interest to Privoxy users:
6401
6402 http://www.privoxy.org/, the Privoxy Home page.
6403
6404 http://www.privoxy.org/faq/, the Privoxy FAQ.
6405
6406 http://sourceforge.net/projects/ijbswa/, the Project Page for Privoxy on
6407 SourceForge.
6408
6409 http://config.privoxy.org/, the web-based user interface. Privoxy must be
6410 running for this to work. Shortcut: http://p.p/
6411
6412 http://sourceforge.net/tracker/?group_id=11118&atid=460288, to submit "misses"
6413 and other configuration related suggestions to the developers.
6414
6415 http://www.junkbusters.com/ht/en/cookies.html, an explanation how cookies are
6416 used to track web users.
6417
6418 http://www.junkbusters.com/ijb.html, the original Internet Junkbuster.
6419
6420 http://privacy.net/, a useful site to check what information about you is
6421 leaked while you browse the web.
6422
6423 http://www.squid-cache.org/, a popular caching proxy, which is often used
6424 together with Privoxy.
6425
6426 http://www.pps.jussieu.fr/~jch/software/polipo/, Polipo is a caching proxy with
6427 advanced features like pipelining, multiplexing and caching of partial
6428 instances. In many setups it can be used as Squid replacement.
6429
6430 http://tor.eff.org/, Tor can help anonymize web browsing, web publishing,
6431 instant messaging, IRC, SSH, and other applications.
6432
6433 http://www.privoxy.org/developer-manual/, the Privoxy developer manual.
6434
6435 -------------------------------------------------------------------------------
6436
6437 14. Appendix
6438
6439 14.1. Regular Expressions
6440
6441 Privoxy uses Perl-style "regular expressions" in its actions files and filter
6442 file, through the PCRE and PCRS libraries.
6443
6444 If you are reading this, you probably don't understand what "regular
6445 expressions" are, or what they can do. So this will be a very brief
6446 introduction only. A full explanation would require a book ;-)
6447
6448 Regular expressions provide a language to describe patterns that can be run
6449 against strings of characters (letter, numbers, etc), to see if they match the
6450 string or not. The patterns are themselves (sometimes complex) strings of
6451 literal characters, combined with wild-cards, and other special characters,
6452 called meta-characters. The "meta-characters" have special meanings and are
6453 used to build complex patterns to be matched against. Perl Compatible Regular
6454 Expressions are an especially convenient "dialect" of the regular expression
6455 language.
6456
6457 To make a simple analogy, we do something similar when we use wild-card
6458 characters when listing files with the dir command in DOS. *.* matches all
6459 filenames. The "special" character here is the asterisk which matches any and
6460 all characters. We can be more specific and use ? to match just individual
6461 characters. So "dir file?.text" would match "file1.txt", "file2.txt", etc. We
6462 are pattern matching, using a similar technique to "regular expressions"!
6463
6464 Regular expressions do essentially the same thing, but are much, much more
6465 powerful. There are many more "special characters" and ways of building complex
6466 patterns however. Let's look at a few of the common ones, and then some
6467 examples:
6468
6469 . - Matches any single character, e.g. "a", "A", "4", ":", or "@".
6470
6471 ? - The preceding character or expression is matched ZERO or ONE times. Either/
6472 or.
6473
6474 + - The preceding character or expression is matched ONE or MORE times.
6475
6476 * - The preceding character or expression is matched ZERO or MORE times.
6477
6478 \ - The "escape" character denotes that the following character should be taken
6479 literally. This is used where one of the special characters (e.g. ".") needs to
6480 be taken literally and not as a special meta-character. Example: "example
6481 \.com", makes sure the period is recognized only as a period (and not expanded
6482 to its meta-character meaning of any single character).
6483
6484 [ ] - Characters enclosed in brackets will be matched if any of the enclosed
6485 characters are encountered. For instance, "[0-9]" matches any numeric digit
6486 (zero through nine). As an example, we can combine this with "+" to match any
6487 digit one of more times: "[0-9]+".
6488
6489 ( ) - parentheses are used to group a sub-expression, or multiple
6490 sub-expressions.
6491
6492 | - The "bar" character works like an "or" conditional statement. A match is
6493 successful if the sub-expression on either side of "|" matches. As an example:
6494 "/(this|that) example/" uses grouping and the bar character and would match
6495 either "this example" or "that example", and nothing else.
6496
6497 These are just some of the ones you are likely to use when matching URLs with
6498 Privoxy, and is a long way from a definitive list. This is enough to get us
6499 started with a few simple examples which may be more illuminating:
6500
6501 /.*/banners/.* - A simple example that uses the common combination of "." and
6502 "*" to denote any character, zero or more times. In other words, any string at
6503 all. So we start with a literal forward slash, then our regular expression
6504 pattern (".*") another literal forward slash, the string "banners", another
6505 forward slash, and lastly another ".*". We are building a directory path here.
6506 This will match any file with the path that has a directory named "banners" in
6507 it. The ".*" matches any characters, and this could conceivably be more forward
6508 slashes, so it might expand into a much longer looking path. For example, this
6509 could match: "/eye/hate/spammers/banners/annoy_me_please.gif", or just "/
6510 banners/annoying.html", or almost an infinite number of other possible
6511 combinations, just so it has "banners" in the path somewhere.
6512
6513 And now something a little more complex:
6514
6515 /.*/adv((er)?ts?|ertis(ing|ements?))?/ - We have several literal forward
6516 slashes again ("/"), so we are building another expression that is a file path
6517 statement. We have another ".*", so we are matching against any conceivable
6518 sub-path, just so it matches our expression. The only true literal that must
6519 match our pattern is adv, together with the forward slashes. What comes after
6520 the "adv" string is the interesting part.
6521
6522 Remember the "?" means the preceding expression (either a literal character or
6523 anything grouped with "(...)" in this case) can exist or not, since this means
6524 either zero or one match. So "((er)?ts?|ertis(ing|ements?))" is optional, as
6525 are the individual sub-expressions: "(er)", "(ing|ements?)", and the "s". The "
6526 |" means "or". We have two of those. For instance, "(ing|ements?)", can expand
6527 to match either "ing" OR "ements?". What is being done here, is an attempt at
6528 matching as many variations of "advertisement", and similar, as possible. So
6529 this would expand to match just "adv", or "advert", or "adverts", or
6530 "advertising", or "advertisement", or "advertisements". You get the idea. But
6531 it would not match "advertizements" (with a "z"). We could fix that by changing
6532 our regular expression to: "/.*/adv((er)?ts?|erti(s|z)(ing|ements?))?/", which
6533 would then match either spelling.
6534
6535 /.*/advert[0-9]+\.(gif|jpe?g) - Again another path statement with forward
6536 slashes. Anything in the square brackets "[ ]" can be matched. This is using
6537 "0-9" as a shorthand expression to mean any digit one through nine. It is the
6538 same as saying "0123456789". So any digit matches. The "+" means one or more of
6539 the preceding expression must be included. The preceding expression here is
6540 what is in the square brackets -- in this case, any digit one through nine.
6541 Then, at the end, we have a grouping: "(gif|jpe?g)". This includes a "|", so
6542 this needs to match the expression on either side of that bar character also. A
6543 simple "gif" on one side, and the other side will in turn match either "jpeg"
6544 or "jpg", since the "?" means the letter "e" is optional and can be matched
6545 once or not at all. So we are building an expression here to match image GIF or
6546 JPEG type image file. It must include the literal string "advert", then one or
6547 more digits, and a "." (which is now a literal, and not a special character,
6548 since it is escaped with "\"), and lastly either "gif", or "jpeg", or "jpg".
6549 Some possible matches would include: "//advert1.jpg", "/nasty/ads/
6550 advert1234.gif", "/banners/from/hell/advert99.jpg". It would not match
6551 "advert1.gif" (no leading slash), or "/adverts232.jpg" (the expression does not
6552 include an "s"), or "/advert1.jsp" ("jsp" is not in the expression anywhere).
6553
6554 We are barely scratching the surface of regular expressions here so that you
6555 can understand the default Privoxy configuration files, and maybe use this
6556 knowledge to customize your own installation. There is much, much more that can
6557 be done with regular expressions. Now that you know enough to get started, you
6558 can learn more on your own :/
6559
6560 More reading on Perl Compatible Regular expressions: http://perldoc.perl.org/
6561 perlre.html
6562
6563 For information on regular expression based substitutions and their
6564 applications in filters, please see the filter file tutorial in this manual.
6565
6566 -------------------------------------------------------------------------------
6567
6568 14.2. Privoxy's Internal Pages
6569
6570 Since Privoxy proxies each requested web page, it is easy for Privoxy to trap
6571 certain special URLs. In this way, we can talk directly to Privoxy, and see how
6572 it is configured, see how our rules are being applied, change these rules and
6573 other configuration options, and even turn Privoxy's filtering off, all with a
6574 web browser. 
6575
6576 The URLs listed below are the special ones that allow direct access to Privoxy.
6577 Of course, Privoxy must be running to access these. If not, you will get a
6578 friendly error message. Internet access is not necessary either.
6579
6580   * Privoxy main page:
6581
6582         http://config.privoxy.org/
6583
6584     There is a shortcut: http://p.p/ (But it doesn't provide a fall-back to a
6585     real page, in case the request is not sent through Privoxy)
6586
6587   * Show information about the current configuration, including viewing and
6588     editing of actions files:
6589
6590         http://config.privoxy.org/show-status
6591
6592   * Show the source code version numbers:
6593
6594         http://config.privoxy.org/show-version
6595
6596   * Show the browser's request headers:
6597
6598         http://config.privoxy.org/show-request
6599
6600   * Show which actions apply to a URL and why:
6601
6602         http://config.privoxy.org/show-url-info
6603
6604   * Toggle Privoxy on or off. This feature can be turned off/on in the main
6605     config file. When toggled "off", "Privoxy" continues to run, but only as a
6606     pass-through proxy, with no actions taking place:
6607
6608         http://config.privoxy.org/toggle
6609
6610     Short cuts. Turn off, then on:
6611
6612         http://config.privoxy.org/toggle?set=disable
6613
6614         http://config.privoxy.org/toggle?set=enable
6615
6616 These may be bookmarked for quick reference. See next. 
6617
6618 -------------------------------------------------------------------------------
6619
6620 14.2.1. Bookmarklets
6621
6622 Below are some "bookmarklets" to allow you to easily access a "mini" version of
6623 some of Privoxy's special pages. They are designed for MS Internet Explorer,
6624 but should work equally well in Netscape, Mozilla, and other browsers which
6625 support JavaScript. They are designed to run directly from your bookmarks - not
6626 by clicking the links below (although that should work for testing).
6627
6628 To save them, right-click the link and choose "Add to Favorites" (IE) or "Add
6629 Bookmark" (Netscape). You will get a warning that the bookmark "may not be
6630 safe" - just click OK. Then you can run the Bookmarklet directly from your
6631 favorites/bookmarks. For even faster access, you can put them on the "Links"
6632 bar (IE) or the "Personal Toolbar" (Netscape), and run them with a single
6633 click.
6634
6635   * Privoxy - Enable
6636
6637   * Privoxy - Disable
6638
6639   * Privoxy - Toggle Privoxy (Toggles between enabled and disabled)
6640
6641   * Privoxy- View Status
6642
6643   * Privoxy - Why?
6644
6645 Credit: The site which gave us the general idea for these bookmarklets is
6646 www.bookmarklets.com. They have more information about bookmarklets.
6647
6648 -------------------------------------------------------------------------------
6649
6650 14.3. Chain of Events
6651
6652 Let's take a quick look at how some of Privoxy's core features are triggered,
6653 and the ensuing sequence of events when a web page is requested by your
6654 browser:
6655
6656   * First, your web browser requests a web page. The browser knows to send the
6657     request to Privoxy, which will in turn, relay the request to the remote web
6658     server after passing the following tests:
6659
6660   * Privoxy traps any request for its own internal CGI pages (e.g http://p.p/)
6661     and sends the CGI page back to the browser.
6662
6663   * Next, Privoxy checks to see if the URL matches any "+block" patterns. If
6664     so, the URL is then blocked, and the remote web server will not be
6665     contacted. "+handle-as-image" and "+handle-as-empty-document" are then
6666     checked, and if there is no match, an HTML "BLOCKED" page is sent back to
6667     the browser. Otherwise, if it does match, an image is returned for the
6668     former, and an empty text document for the latter. The type of image would
6669     depend on the setting of "+set-image-blocker" (blank, checkerboard pattern,
6670     or an HTTP redirect to an image elsewhere).
6671
6672   * Untrusted URLs are blocked. If URLs are being added to the trust file, then
6673     that is done.
6674
6675   * If the URL pattern matches the "+fast-redirects" action, it is then
6676     processed. Unwanted parts of the requested URL are stripped.
6677
6678   * Now the rest of the client browser's request headers are processed. If any
6679     of these match any of the relevant actions (e.g. "+hide-user-agent", etc.),
6680     headers are suppressed or forged as determined by these actions and their
6681     parameters.
6682
6683   * Now the web server starts sending its response back (i.e. typically a web
6684     page).
6685
6686   * First, the server headers are read and processed to determine, among other
6687     things, the MIME type (document type) and encoding. The headers are then
6688     filtered as determined by the "+crunch-incoming-cookies",
6689     "+session-cookies-only", and "+downgrade-http-version" actions.
6690
6691   * If the "+kill-popups" action applies, and it is an HTML or JavaScript
6692     document, the popup-code in the response is filtered on-the-fly as it is
6693     received.
6694
6695   * If any "+filter" action or "+deanimate-gifs" action applies (and the
6696     document type fits the action), the rest of the page is read into memory
6697     (up to a configurable limit). Then the filter rules (from default.filter
6698     and any other filter files) are processed against the buffered content.
6699     Filters are applied in the order they are specified in one of the filter
6700     files. Animated GIFs, if present, are reduced to either the first or last
6701     frame, depending on the action setting.The entire page, which is now
6702     filtered, is then sent by Privoxy back to your browser.
6703
6704     If neither a "+filter" action or "+deanimate-gifs" matches, then Privoxy
6705     passes the raw data through to the client browser as it becomes available.
6706
6707   * As the browser receives the now (possibly filtered) page content, it reads
6708     and then requests any URLs that may be embedded within the page source,
6709     e.g. ad images, stylesheets, JavaScript, other HTML documents (e.g.
6710     frames), sounds, etc. For each of these objects, the browser issues a
6711     separate request (this is easily viewable in Privoxy's logs). And each such
6712     request is in turn processed just as above. Note that a complex web page
6713     will have many, many such embedded URLs. If these secondary requests are to
6714     a different server, then quite possibly a very differing set of actions is
6715     triggered.
6716
6717 NOTE: This is somewhat of a simplistic overview of what happens with each URL
6718 request. For the sake of brevity and simplicity, we have focused on Privoxy's
6719 core features only.
6720
6721 -------------------------------------------------------------------------------
6722
6723 14.4. Troubleshooting: Anatomy of an Action
6724
6725 The way Privoxy applies actions and filters to any given URL can be complex,
6726 and not always so easy to understand what is happening. And sometimes we need
6727 to be able to see just what Privoxy is doing. Especially, if something Privoxy
6728 is doing is causing us a problem inadvertently. It can be a little daunting to
6729 look at the actions and filters files themselves, since they tend to be filled
6730 with regular expressions whose consequences are not always so obvious.
6731
6732 One quick test to see if Privoxy is causing a problem or not, is to disable it
6733 temporarily. This should be the first troubleshooting step. See the
6734 Bookmarklets section on a quick and easy way to do this (be sure to flush
6735 caches afterward!). Looking at the logs is a good idea too. (Note that both the
6736 toggle feature and logging are enabled via config file settings, and may need
6737 to be turned "on".)
6738
6739 Another easy troubleshooting step to try is if you have done any customization
6740 of your installation, revert back to the installed defaults and see if that
6741 helps. There are times the developers get complaints about one thing or
6742 another, and the problem is more related to a customized configuration issue.
6743
6744 Privoxy also provides the http://config.privoxy.org/show-url-info page that can
6745 show us very specifically how actions are being applied to any given URL. This
6746 is a big help for troubleshooting.
6747
6748 First, enter one URL (or partial URL) at the prompt, and then Privoxy will tell
6749 us how the current configuration will handle it. This will not help with
6750 filtering effects (i.e. the "+filter" action) from one of the filter files
6751 since this is handled very differently and not so easy to trap! It also will
6752 not tell you about any other URLs that may be embedded within the URL you are
6753 testing. For instance, images such as ads are expressed as URLs within the raw
6754 page source of HTML pages. So you will only get info for the actual URL that is
6755 pasted into the prompt area -- not any sub-URLs. If you want to know about
6756 embedded URLs like ads, you will have to dig those out of the HTML source. Use
6757 your browser's "View Page Source" option for this. Or right click on the ad,
6758 and grab the URL.
6759
6760 Let's try an example, google.com, and look at it one section at a time in a
6761 sample configuration (your real configuration may vary):
6762
6763  Matches for http://www.google.com:
6764
6765  In file: default.action [ View ] [ Edit ]
6766
6767  {+deanimate-gifs {last}
6768  +fast-redirects {check-decoded-url}
6769  +filter {refresh-tags}
6770  +filter {img-reorder}
6771  +filter {banners-by-size}
6772  +filter {webbugs}
6773  +filter {jumping-windows}
6774  +filter {ie-exploits}
6775  +hide-forwarded-for-headers
6776  +hide-from-header {block}
6777  +hide-referrer {forge}
6778  +session-cookies-only
6779  +set-image-blocker {pattern}
6780 /
6781
6782  { -session-cookies-only }
6783  .google.com
6784
6785  { -fast-redirects }
6786  .google.com
6787
6788 In file: user.action [ View ] [ Edit ]
6789 (no matches in this file)
6790
6791
6792 This is telling us how we have defined our "actions", and which ones match for
6793 our test case, "google.com". Displayed is all the actions that are available to
6794 us. Remember, the + sign denotes "on". - denotes "off". So some are "on" here,
6795 but many are "off". Each example we try may provide a slightly different end
6796 result, depending on our configuration directives.
6797
6798 The first listing is for our default.action file. The large, multi-line
6799 listing, is how the actions are set to match for all URLs, i.e. our default
6800 settings. If you look at your "actions" file, this would be the section just
6801 below the "aliases" section near the top. This will apply to all URLs as
6802 signified by the single forward slash at the end of the listing -- " / ".
6803
6804 But we have defined additional actions that would be exceptions to these
6805 general rules, and then we list specific URLs (or patterns) that these
6806 exceptions would apply to. Last match wins. Just below this then are two
6807 explicit matches for ".google.com". The first is negating our previous cookie
6808 setting, which was for "+session-cookies-only" (i.e. not persistent). So we
6809 will allow persistent cookies for google, at least that is how it is in this
6810 example. The second turns off any "+fast-redirects" action, allowing this to
6811 take place unmolested. Note that there is a leading dot here -- ".google.com".
6812 This will match any hosts and sub-domains, in the google.com domain also, such
6813 as "www.google.com" or "mail.google.com". But it would not match
6814 "www.google.de"! So, apparently, we have these two actions defined as
6815 exceptions to the general rules at the top somewhere in the lower part of our
6816 default.action file, and "google.com" is referenced somewhere in these latter
6817 sections.
6818
6819 Then, for our user.action file, we again have no hits. So there is nothing
6820 google-specific that we might have added to our own, local configuration. If
6821 there was, those actions would over-rule any actions from previously processed
6822 files, such as default.action. user.action typically has the last word. This is
6823 the best place to put hard and fast exceptions,
6824
6825 And finally we pull it all together in the bottom section and summarize how
6826 Privoxy is applying all its "actions" to "google.com": 
6827
6828  Final results:
6829
6830  -add-header
6831  -block
6832  -client-header-filter{hide-tor-exit-notation}
6833  -content-type-overwrite
6834  -crunch-client-header
6835  -crunch-if-none-match
6836  -crunch-incoming-cookies
6837  -crunch-outgoing-cookies
6838  -crunch-server-header
6839  +deanimate-gifs {last}
6840  -downgrade-http-version
6841  -fast-redirects
6842  -filter {js-events}
6843  -filter {content-cookies}
6844  -filter {all-popups}
6845  -filter {banners-by-link}
6846  -filter {tiny-textforms}
6847  -filter {frameset-borders}
6848  -filter {demoronizer}
6849  -filter {shockwave-flash}
6850  -filter {quicktime-kioskmode}
6851  -filter {fun}
6852  -filter {crude-parental}
6853  -filter {site-specifics}
6854  -filter {js-annoyances}
6855  -filter {html-annoyances}
6856  +filter {refresh-tags}
6857  -filter {unsolicited-popups}
6858  +filter {img-reorder}
6859  +filter {banners-by-size}
6860  +filter {webbugs}
6861  +filter {jumping-windows}
6862  +filter {ie-exploits}
6863  -filter {google}
6864  -filter {yahoo}
6865  -filter {msn}
6866  -filter {blogspot}
6867  -filter {no-ping}
6868  -force-text-mode
6869  -handle-as-empty-document
6870  -handle-as-image
6871  -hide-accept-language
6872  -hide-content-disposition
6873  +hide-forwarded-for-headers
6874  +hide-from-header {block}
6875  -hide-if-modified-since
6876  +hide-referrer {forge}
6877  -hide-user-agent
6878  -inspect-jpegs
6879  -kill-popups
6880  -limit-connect
6881  -overwrite-last-modified
6882  -prevent-compression
6883  -redirect
6884  -send-vanilla-wafer
6885  -send-wafer
6886  -server-header-filter{xml-to-html}
6887  -server-header-filter{html-to-xml}
6888  -session-cookies-only
6889  +set-image-blocker {pattern}
6890  -treat-forbidden-connects-like-blocks
6891
6892
6893 Notice the only difference here to the previous listing, is to "fast-redirects"
6894 and "session-cookies-only", which are activated specifically for this site in
6895 our configuration, and thus show in the "Final Results".
6896
6897 Now another example, "ad.doubleclick.net":
6898
6899  { +block }
6900   ad*.
6901
6902  { +block }
6903   .ad.
6904
6905  { +block +handle-as-image }
6906   .[a-vx-z]*.doubleclick.net
6907
6908
6909 We'll just show the interesting part here - the explicit matches. It is matched
6910 three different times. Two "+block" sections, and a "+block +handle-as-image",
6911 which is the expanded form of one of our aliases that had been defined as:
6912 "+block-as-image". ("Aliases" are defined in the first section of the actions
6913 file and typically used to combine more than one action.)
6914
6915 Any one of these would have done the trick and blocked this as an unwanted
6916 image. This is unnecessarily redundant since the last case effectively would
6917 also cover the first. No point in taking chances with these guys though ;-)
6918 Note that if you want an ad or obnoxious URL to be invisible, it should be
6919 defined as "ad.doubleclick.net" is done here -- as both a "+block" and an
6920 "+handle-as-image". The custom alias "+block-as-image" just simplifies the
6921 process and make it more readable.
6922
6923 One last example. Let's try "http://www.example.net/adsl/HOWTO/". This one is
6924 giving us problems. We are getting a blank page. Hmmm ...
6925
6926  Matches for http://www.example.net/adsl/HOWTO/:
6927
6928  In file: default.action [ View ] [ Edit ]
6929
6930  {-add-header
6931   -block
6932   -client-header-filter{hide-tor-exit-notation}
6933   -content-type-overwrite
6934   -crunch-client-header
6935   -crunch-if-none-match
6936   -crunch-incoming-cookies
6937   -crunch-outgoing-cookies
6938   -crunch-server-header
6939   +deanimate-gifs
6940   -downgrade-http-version
6941   +fast-redirects {check-decoded-url}
6942   -filter {js-events}
6943   -filter {content-cookies}
6944   -filter {all-popups}
6945   -filter {banners-by-link}
6946   -filter {tiny-textforms}
6947   -filter {frameset-borders}
6948   -filter {demoronizer}
6949   -filter {shockwave-flash}
6950   -filter {quicktime-kioskmode}
6951   -filter {fun}
6952   -filter {crude-parental}
6953   -filter {site-specifics}
6954   -filter {js-annoyances}
6955   -filter {html-annoyances}
6956   +filter {refresh-tags}
6957   -filter {unsolicited-popups}
6958   +filter {img-reorder}
6959   +filter {banners-by-size}
6960   +filter {webbugs}
6961   +filter {jumping-windows}
6962   +filter {ie-exploits}
6963   -filter {google}
6964   -filter {yahoo}
6965   -filter {msn}
6966   -filter {blogspot}
6967   -filter {no-ping}
6968   -force-text-mode
6969   -handle-as-empty-document
6970   -handle-as-image
6971   -hide-accept-language
6972   -hide-content-disposition
6973   +hide-forwarded-for-headers
6974   +hide-from-header{block}
6975   +hide-referer{forge}
6976   -hide-user-agent
6977   -inspect-jpegs
6978   -kill-popups
6979   -overwrite-last-modified
6980   +prevent-compression
6981   -redirect
6982   -send-vanilla-wafer
6983   -send-wafer
6984   -server-header-filter{xml-to-html}
6985   -server-header-filter{html-to-xml}
6986   +session-cookies-only
6987   +set-image-blocker{blank}
6988   -treat-forbidden-connects-like-blocks }
6989    /
6990
6991  { +block +handle-as-image }
6992   /ads
6993
6994
6995 Ooops, the "/adsl/" is matching "/ads" in our configuration! But we did not
6996 want this at all! Now we see why we get the blank page. It is actually
6997 triggering two different actions here, and the effects are aggregated so that
6998 the URL is blocked, and Privoxy is told to treat the block as if it were an
6999 image. But this is, of course, all wrong. We could now add a new action below
7000 this (or better in our own user.action file) that explicitly un blocks ( "
7001 {-block}") paths with "adsl" in them (remember, last match in the configuration
7002 wins). There are various ways to handle such exceptions. Example:
7003
7004  { -block }
7005   /adsl
7006
7007
7008 Now the page displays ;-) Remember to flush your browser's caches when making
7009 these kinds of changes to your configuration to insure that you get a freshly
7010 delivered page! Or, try using Shift+Reload.
7011
7012 But now what about a situation where we get no explicit matches like we did
7013 with:
7014
7015  { +block +handle-as-image }
7016  /ads
7017
7018
7019 That actually was very helpful and pointed us quickly to where the problem was.
7020 If you don't get this kind of match, then it means one of the default rules in
7021 the first section of default.action is causing the problem. This would require
7022 some guesswork, and maybe a little trial and error to isolate the offending
7023 rule. One likely cause would be one of the "+filter" actions. These tend to be
7024 harder to troubleshoot. Try adding the URL for the site to one of aliases that
7025 turn off "+filter":
7026
7027  { shop }
7028  .quietpc.com
7029  .worldpay.com   # for quietpc.com
7030  .jungle.com
7031  .scan.co.uk
7032  .forbes.com
7033
7034
7035 "{ shop }" is an "alias" that expands to "{ -filter -session-cookies-only }".
7036 Or you could do your own exception to negate filtering: 
7037
7038  { -filter }
7039  # Disable ALL filter actions for sites in this section
7040  .forbes.com
7041  developer.ibm.com
7042  localhost
7043
7044
7045 This would turn off all filtering for these sites. This is best put in
7046 user.action, for local site exceptions. Note that when a simple domain pattern
7047 is used by itself (without the subsequent path portion), all sub-pages within
7048 that domain are included automatically in the scope of the action.
7049
7050 Images that are inexplicably being blocked, may well be hitting the "+filter
7051 {banners-by-size}" rule, which assumes that images of certain sizes are ad
7052 banners (works well most of the time since these tend to be standardized).
7053
7054 "{ fragile }" is an alias that disables most actions that are the most likely
7055 to cause trouble. This can be used as a last resort for problem sites.
7056
7057  { fragile }
7058  # Handle with care: easy to break
7059  mail.google.
7060  mybank.example.com
7061
7062
7063 Remember to flush caches! Note that the mail.google reference lacks the TLD
7064 portion (e.g. ".com"). This will effectively match any TLD with google in it,
7065 such as mail.google.de., just as an example.
7066
7067 If this still does not work, you will have to go through the remaining actions
7068 one by one to find which one(s) is causing the problem.
7069