1 Privoxy 3.0.3 User Manual
3 [ Copyright © 2001 - 2004 by Privoxy Developers ]
5 $Id: user-manual.txt,v 1.60.2.7 2004/01/30 23:46:57 oes Exp $
7 The User Manual gives users information on how to install, configure and use
10 Privoxy is a web proxy with advanced filtering capabilities for protecting
11 privacy, modifying web page content, managing cookies, controlling access, and
12 removing ads, banners, pop-ups and other obnoxious Internet junk. Privoxy has a
13 very flexible configuration and can be customized to suit individual needs and
14 tastes. Privoxy has application for both stand-alone systems and multi-user
17 Privoxy is based on Internet Junkbuster (tm).
19 You can find the latest version of the User Manual at http://www.privoxy.org/
20 user-manual/. Please see the Contact section on how to contact the developers.
22 -------------------------------------------------------------------------------
33 2.1.1. Red Hat, SuSE and Conectiva RPMs
36 2.1.4. Solaris, NetBSD, FreeBSD, HP-UX
42 2.2. Building from Source
43 2.3. Keeping your Installation Up-to-Date
46 4. Quickstart to Using Privoxy
48 4.1. Quickstart to Ad Blocking
52 5.1. Red Hat and Conectiva
56 5.5. Solaris, NetBSD, FreeBSD, HP-UX and others
61 5.10. Command Line Options
63 6. Privoxy Configuration
65 6.1. Controlling Privoxy with Your Web Browser
66 6.2. Configuration Files Overview
68 7. The Main Configuration File
70 7.1. Configuration and Log File Locations
80 7.2. Local Set-up Documentation
90 7.3.2. single-threaded
92 7.4. Access Control and Security
96 7.4.3. enable-remote-toggle
97 7.4.4. enable-edit-actions
98 7.4.5. ACLs: permit-access and deny-access
104 7.5.2. forward-socks4 and forward-socks4a
105 7.5.3. Advanced Forwarding Examples
107 7.6. Windows GUI Options
111 8.1. Finding the Right Mix
113 8.3. How Actions are Applied to URLs
116 8.4.1. The Domain Pattern
117 8.4.2. The Path Pattern
123 8.5.3. crunch-incoming-cookies
124 8.5.4. crunch-outgoing-cookies
125 8.5.5. deanimate-gifs
126 8.5.6. downgrade-http-version
127 8.5.7. fast-redirects
129 8.5.9. handle-as-image
130 8.5.10. hide-forwarded-for-headers
131 8.5.11. hide-from-header
132 8.5.12. hide-referrer
133 8.5.13. hide-user-agent
135 8.5.15. limit-connect
136 8.5.16. prevent-compression
137 8.5.17. send-vanilla-wafer
139 8.5.19. session-cookies-only
140 8.5.20. set-image-blocker
144 8.7. Actions Files Tutorial
146 8.7.1. default.action
151 9.1. Filter File Tutorial
152 9.2. The Pre-defined Filters
155 11. Contacting the Developers, Bug Reporting and Feature Requests
159 11.3. Request New Features
160 11.4. Report Ads or Other Actions-Related Problems
163 12. Privoxy Copyright, License and History
172 14.1. Regular Expressions
173 14.2. Privoxy's Internal Pages
177 14.3. Chain of Events
178 14.4. Anatomy of an Action
182 This documentation is included with the current stable version of Privoxy,
185 -------------------------------------------------------------------------------
189 In addition to Internet Junkbuster's traditional features of ad and banner
190 blocking and cookie management, Privoxy provides new features:
192 * Integrated browser based configuration and control utility at http://
193 config.privoxy.org/ (shortcut: http://p.p/). Browser-based tracing of rule
194 and filter effects. Remote toggling.
196 * Web page content filtering (removes banners based on size, invisible
197 "web-bugs", JavaScript and HTML annoyances, pop-up windows, etc.)
199 * Modularized configuration that allows for standard settings and user
200 settings to reside in separate files, so that installing updated actions
201 files won't overwrite individual user settings.
203 * HTTP/1.1 compliant (but not all optional 1.1 features are supported).
205 * Support for Perl Compatible Regular Expressions in the configuration files,
206 and generally a more sophisticated and flexible configuration syntax over
209 * Improved cookie management features (e.g. session based cookies).
213 * Bypass many click-tracking scripts (avoids script redirection).
215 * Multi-threaded (POSIX and native threads).
217 * User-customizable HTML templates for all proxy-generated pages (e.g.
220 * Auto-detection and re-reading of config file changes.
222 * Improved signal handling, and a true daemon mode (Unix).
224 * Every feature now controllable on a per-site or per-location basis,
225 configuration more powerful and versatile over-all.
227 * Many smaller new features added, limitations and bugs removed, and security
230 -------------------------------------------------------------------------------
234 Privoxy is available both in convenient pre-compiled packages for a wide range
235 of operating systems, and as raw source code. For most users, we recommend
236 using the packages, which can be downloaded from our Privoxy Project Page.
238 Note: If you have a previous Junkbuster or Privoxy installation on your system,
239 you will need to remove it. On some platforms, this may be done for you as part
240 of their installation procedure. (See below for your platform). In any case be
241 sure to backup your old configuration if it is valuable to you. See the note to
242 upgraders section below.
244 -------------------------------------------------------------------------------
248 How to install the binary packages depends on your operating system:
250 -------------------------------------------------------------------------------
252 2.1.1. Red Hat, SuSE and Conectiva RPMs
254 RPMs can be installed with rpm -Uvh privoxy-3.0.3-1.rpm, and will use /etc/
255 privoxy for the location of configuration files.
257 Note that on Red Hat, Privoxy will not be automatically started on system boot.
258 You will need to enable that using chkconfig, ntsysv, or similar methods. Note
259 that SuSE will automatically start Privoxy in the boot process.
261 If you have problems with failed dependencies, try rebuilding the SRC RPM: rpm
262 --rebuild privoxy-3.0.3-1.src.rpm. This will use your locally installed
263 libraries and RPM version.
265 Also note that if you have a Junkbuster RPM installed on your system, you need
266 to remove it first, because the packages conflict. Otherwise, RPM will try to
267 remove Junkbuster automatically, before installing Privoxy.
269 -------------------------------------------------------------------------------
273 DEBs can be installed with apt-get install privoxy, and will use /etc/privoxy
274 for the location of configuration files.
276 -------------------------------------------------------------------------------
280 Just double-click the installer, which will guide you through the installation
281 process. You will find the configuration files in the same directory as you
282 installed Privoxy in. We do not use the registry of Windows.
284 -------------------------------------------------------------------------------
286 2.1.4. Solaris, NetBSD, FreeBSD, HP-UX
288 Create a new directory, cd to it, then unzip and untar the archive. For the
289 most part, you'll have to figure out where things go.
291 -------------------------------------------------------------------------------
295 First, make sure that no previous installations of Junkbuster and / or Privoxy
296 are left on your system. Check that no Junkbuster or Privoxy objects are in
299 Then, just double-click the WarpIN self-installing archive, which will guide
300 you through the installation process. A shadow of the Privoxy executable will
301 be placed in your startup folder so it will start automatically whenever OS/2
304 The directory you choose to install Privoxy into will contain all of the
307 -------------------------------------------------------------------------------
311 Unzip the downloaded file (you can either double-click on the file from the
312 finder, or from the desktop if you downloaded it there). Then, double-click on
313 the package installer icon named Privoxy.pkg and follow the installation
314 process. Privoxy will be installed in the folder /Library/Privoxy. It will
315 start automatically whenever you start up. To prevent it from starting
316 automatically, remove or rename the folder /Library/StartupItems/Privoxy.
318 To start Privoxy by hand, double-click on StartPrivoxy.command in the /Library/
319 Privoxy folder. Or, type this command in the Terminal:
321 /Library/Privoxy/StartPrivoxy.command
325 You will be prompted for the administrator password.
327 -------------------------------------------------------------------------------
331 Copy and then unpack the lha archive to a suitable location. All necessary
332 files will be installed into Privoxy directory, including all configuration and
333 log files. To uninstall, just remove this directory.
335 -------------------------------------------------------------------------------
339 Gentoo source packages (Ebuilds) for Privoxy are contained in the Gentoo
340 Portage Tree (they are not on the download page, but there is a Gentoo section,
341 where you can see when a new Privoxy Version is added to the Portage Tree).
343 Before installing Privoxy under Gentoo just do first emerge rsync to get the
344 latest changes from the Portage tree. With emerge privoxy you install the
347 Configuration files are in /etc/privoxy, the documentation is in /usr/share/doc
348 /privoxy-3.0.3 and the Log directory is in /var/log/privoxy.
350 -------------------------------------------------------------------------------
352 2.2. Building from Source
354 The most convenient way to obtain the Privoxy sources is to download the source
355 tarball from our project page.
357 If you like to live on the bleeding edge and are not afraid of using possibly
358 unstable development versions, you can check out the up-to-the-minute version
359 directly from the CVS repository or simply download the nightly CVS tarball.
361 To build Privoxy from source, autoconf, GNU make (gmake), and, of course, a C
362 compiler like gcc are required.
364 When building from a source tarball (either release version or nightly CVS
365 tarball), first unpack the source:
367 tar xzvf privoxy-3.0.3-src* [.tgz or .tar.gz]
371 For retrieving the current CVS sources, you'll need CVS installed. Note that
372 sources from CVS are development quality, and may not be stable, or well
373 tested. To download CVS source:
375 cvs -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa login
376 cvs -z3 -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa co current
380 This will create a directory named current/, which will contain the source
383 Then, in either case, to build from unpacked tarball or CVS source:
387 ./configure # (--help to see options)
388 make # (the make from gnu, gmake for *BSD)
390 make -n install # (to see where all the files will go)
391 make install # (to really install)
394 If you have gnu make, you can have the first four steps automatically done for
400 in the freshly downloaded or unpacked source directory.
402 For more detailed instructions on how to build Redhat and SuSE RPMs, Windows
403 self-extracting installers, building on platforms with special requirements
404 etc, please consult the developer manual.
406 -------------------------------------------------------------------------------
408 2.3. Keeping your Installation Up-to-Date
410 As user feedback comes in and development continues, we will make updated
411 versions of both the main actions file (as a separate package) and the software
412 itself (including the actions file) available for download.
414 If you wish to receive an email notification whenever we release updates of
415 Privoxy or the actions file, subscribe to our announce mailing list,
416 ijbswa-announce@lists.sourceforge.net.
418 In order not to loose your personal changes and adjustments when updating to
419 the latest default.action file we strongly recommend that you use user.action
420 for your customization of Privoxy. See the Chapter on actions files for
423 -------------------------------------------------------------------------------
427 There are very significant changes from earlier Junkbuster versions to the
428 current Privoxy. The number, names, syntax, and purposes of configuration files
429 have substantially changed. Junkbuster 2.0.x configuration files will not
430 migrate, Junkbuster 2.9.x and Privoxy configurations will need to be ported.
431 The functionalities of the old blockfile, cookiefile and imagelist are now
432 combined into the "actions files". default.action, is the main actions file.
433 Local exceptions should best be put into user.action.
435 A "filter file" (typically default.filter) is new as of Privoxy 2.9.x, and
436 provides some of the new sophistication (explained below). config is much the
439 If upgrading from a 2.0.x version, you will have to use the new config files,
440 and possibly adapt any personal rules from your older files. When porting
441 personal rules over from the old blockfile to the new actions files, please
442 note that even the pattern syntax has changed. If upgrading from 2.9.x
443 development versions, it is still recommended to use the new configuration
446 A quick list of things to be aware of before upgrading:
448 * The default listening port is now 8118 due to a conflict with another
451 * Some installers may remove earlier versions completely. Save any important
454 * Privoxy is controllable with a web browser at the special URL: http://
455 config.privoxy.org/ (Shortcut: http://p.p/). Many aspects of configuration
456 can be done here, including temporarily disabling Privoxy.
458 * The primary configuration files for cookie management, ad and banner
459 blocking, and many other aspects of Privoxy configuration are the actions
460 files. It is strongly recommended to become familiar with the new actions
461 concept below, before modifying these files. Locally defined rules should
464 * Some installers may not automatically start Privoxy after installation.
466 -------------------------------------------------------------------------------
468 4. Quickstart to Using Privoxy
470 * If upgrading, from versions before 2.9.16, please back up any configuration
471 files. See the Note to Upgraders Section.
473 * Install Privoxy. See the Installation Section below for platform specific
476 * Advanced users and those who want to offer Privoxy service to more than
477 just their local machine should check the main config file, especially the
478 security-relevant options. These are off by default.
480 * Start Privoxy, if the installation program has not done this already (may
481 vary according to platform). See the section Starting Privoxy.
483 * Set your browser to use Privoxy as HTTP and HTTPS (SSL) proxy by setting
484 the proxy configuration for address of 127.0.0.1 and port 8118. (Junkbuster
485 and earlier versions of Privoxy used port 8000.) See the section Starting
486 Privoxy below for more details on this.
488 * Flush your browser's disk and memory caches, to remove any cached ad
489 images. If using Privoxy to manage cookies, you should remove any currently
492 * A default installation should provide a reasonable starting point for most.
493 There will undoubtedly be occasions where you will want to adjust the
494 configuration, but that can be dealt with as the need arises. Little to no
495 initial configuration is required in most cases.
497 See the Configuration section for more configuration options, and how to
498 customize your installation.
500 * If you experience ads that slipped through, innocent images that are
501 blocked, or otherwise feel the need to fine-tune Privoxy's behaviour, take
502 a look at the actions files. As a quick start, you might find the richly
503 commented examples helpful. You can also view and edit the actions files
504 through the web-based user interface. The Appendix "Anatomy of an Action"
505 has hints how to debug actions that "misbehave".
507 * For easy access to Privoxy's most important controls, drag the provided
508 Bookmarklets into your browser's personal toolbar.
510 * Please see the section Contacting the Developers on how to report bugs or
511 problems with websites or to get help.
513 * Now enjoy surfing with enhanced comfort and privacy!
515 -------------------------------------------------------------------------------
517 4.1. Quickstart to Ad Blocking
519 Ad blocking is but one of Privoxy's array of features. Many of these features
520 are for the technically minded advanced user. But, ad and banner blocking is
521 surely common ground for everybody.
523 This section will provide a quick summary of ad blocking so you can get up to
524 speed quickly without having to read the more extensive information provided
525 below, though this is highly recommended.
527 First a bit of a warning ... blocking ads is much like blocking SPAM: the more
528 aggressive you are about it, the more likely you are to block things that were
529 not intended. So there is a trade off here. If you want extreme ad free
530 browsing, be prepared to deal with more "problem" sites, and to spend more time
531 adjusting the configuration to solve these unintended consequences. In short,
532 there is not an easy way to eliminate all ads. Either take the easy way and
533 settle for most ads blocked with the default configuration, or jump in and
534 tweak it for your personal surfing habits and preferences.
536 Secondly, a brief explanation of Privoxy's "actions". "Actions" in this
537 context, are the directives we use to tell Privoxy to perform some task
538 relating to HTTP transactions (i.e. web browsing). We tell Privoxy to take some
539 "action". Each action has a unique name and function. While there are many
540 potential actions in Privoxy's arsenal, only a few are used for ad blocking.
541 Actions, and action configuration files, are explained in depth below.
543 Actions are specified in Privoxy's configuration, followed by one or more URLs
544 to which the action should apply. URLs can actually be URL type patterns that
545 use wildcards so they can apply potentially to a range of similar URLs. The
546 actions, together with the URL patterns are called a section.
548 When you connect to a website, the full URL will either match one or more of
549 the sections as defined in Privoxy's configuration, or not. If so, then Privoxy
550 will perform the respective actions. If not, then nothing special happens.
551 Furthermore, web pages may contain embedded, secondary URLs that your web
552 browser will use to load additional components of the page, as it parses the
553 original page's HTML content. An ad image for instance, is just an URL embedded
554 in the page somewhere. The image itself may be on the same server, or a server
555 somewhere else on the Internet. Complex web pages will have many such embedded
558 The actions we need to know about for ad blocking are: block, handle-as-image,
559 and set-image-blocker:
561 * block - this action stops any contact between your browser and any URL
562 patterns that match this action's configuration. It can be used for
563 blocking ads, but also anything that is determined to be unwanted. By
564 itself, it simply stops any communication with the remote server and sends
565 Privoxy's own built-in BLOCKED page instead to let you now what has
568 * handle-as-image - tells Privoxy to treat this URL as an image. Privoxy's
569 default configuration already does this for all common image types (e.g.
570 GIF), but there are many situations where this is not so easy to determine.
571 So we'll force it in these cases. This is particularly important for ad
572 blocking, since only if we know that it's an image of some kind, can we
573 replace it with an image of our choosing, instead of the Privoxy BLOCKED
574 page (which would only result in a "broken image" icon). There are some
575 limitations to this though. For instance, you can't just brute-force an
576 image substitution for an entire HTML page in most situations.
578 * set-image-blocker - tells Privoxy what to display in place of an ad image
579 that has hit a block rule. For this to come into play, the URL must match a
580 block action somewhere in the configuration, and, it must also match an
581 handle-as-image action.
583 The configuration options on what to display instead of the ad are:
585 pattern - a checkerboard pattern, so that an ad replacement is obvious.
588 blank - A very small empty GIF image is displayed. This is the so-called
589 "invisible" configuration option.
591 http://<URL> - A redirect to any image anywhere of the user's choosing
594 The quickest way to adjust any of these settings is with your browser through
595 the special Privoxy editor at http://config.privoxy.org/show-status (shortcut:
596 http://p.p/show-status). This is an internal page, and does not require
597 Internet access. Select the appropriate "actions" file, and click "Edit". It is
598 best to put personal or local preferences in user.action since this is not
599 meant to be overwritten during upgrades, and will over-ride the settings in
600 other files. Here you can insert new "actions", and URLs for ad blocking or
601 other purposes, and make other adjustments to the configuration. Privoxy will
602 detect these changes automatically.
604 A quick and simple step by step example:
606 * Right click on the ad image to be blocked, then select "Copy Link Location"
607 from the pop-up menu.
609 * Set your browser to http://config.privoxy.org/show-status
611 * Find user.action in the top section, and click on "Edit":
613 Figure 1. Actions Files in Use
617 * You should have a section with only block listed under "Actions:". If not,
618 click a "Insert new section below" button, and in the new section that just
619 appeared, click the Edit button right under the word "Actions:". This will
620 bring up a list of all actions. Find block near the top, and click in the
621 "Enabled" column, then "Submit" just below the list.
623 * Now, in the block actions section, click the "Add" button, and paste the
624 URL the browser got from "Copy Link Location". Remove the http:// at the
625 beginning of the URL. Then, click "Submit" (or "OK" if in a pop-up window).
627 * Now go back to the original page, and press SHIFT-Reload (or flush all
628 browser caches). The image should be gone now.
630 This is a very crude and simple example. There might be good reasons to use a
631 wildcard pattern match to include potentially similar images from the same
632 site. For a more extensive explanation of "patterns", and the entire actions
633 concept, see the Actions section.
635 For advanced users who want to hand edit their config files, you might want to
636 now go to the Actions Files Tutorial. The ideas explained therein also apply to
637 the web-based editor.
639 -------------------------------------------------------------------------------
643 Before launching Privoxy for the first time, you will want to configure your
644 browser(s) to use Privoxy as a HTTP and HTTPS proxy. The default is 127.0.0.1
645 (or localhost) for the proxy address, and port 8118 (earlier versions used port
646 8000). This is the one configuration step that must be done!
648 Please note that Privoxy can only proxy HTTP and HTTPS traffic. It will not
649 work with FTP or other protocols.
651 Figure 2. Proxy Configuration (Mozilla)
655 With Netscape (and Mozilla), this can be set under:
667 For Internet Explorer:
677 Then, check "Use Proxy" and fill in the appropriate info (Address: 127.0.0.1,
678 Port: 8118). Include HTTPS (SSL), if you want HTTPS proxy support too.
680 After doing this, flush your browser's disk and memory caches to force a
681 re-reading of all pages and to get rid of any ads that may be cached. You are
682 now ready to start enjoying the benefits of using Privoxy!
684 Privoxy is typically started by specifying the main configuration file to be
685 used on the command line. If no configuration file is specified on the command
686 line, Privoxy will look for a file named config in the current directory.
687 Except on Win32 where it will try config.txt.
689 -------------------------------------------------------------------------------
691 5.1. Red Hat and Conectiva
693 We use a script. Note that Red Hat does not start Privoxy upon booting per
694 default. It will use the file /etc/privoxy/config as its main configuration
697 # /etc/rc.d/init.d/privoxy start
700 -------------------------------------------------------------------------------
704 We use a script. Note that Debian starts Privoxy upon booting per default. It
705 will use the file /etc/privoxy/config as its main configuration file.
707 # /etc/init.d/privoxy start
710 -------------------------------------------------------------------------------
714 We use a script. It will use the file /etc/privoxy/config as its main
715 configuration file. Note that SuSE starts Privoxy upon booting your PC.
720 -------------------------------------------------------------------------------
724 Click on the Privoxy Icon to start Privoxy. If no configuration file is
725 specified on the command line, Privoxy will look for a file named config.txt.
726 Note that Windows will automatically start Privoxy upon booting you PC.
728 -------------------------------------------------------------------------------
730 5.5. Solaris, NetBSD, FreeBSD, HP-UX and others
732 Example Unix startup command:
734 # /usr/sbin/privoxy /etc/privoxy/config
737 -------------------------------------------------------------------------------
741 During installation, Privoxy is configured to start automatically when the
742 system restarts. You can start it manually by double-clicking on the Privoxy
743 icon in the Privoxy folder.
745 -------------------------------------------------------------------------------
749 During installation, Privoxy is configured to start automatically when the
750 system restarts. To start Privoxy by hand, double-click on the
751 StartPrivoxy.command icon in the /Library/Privoxy folder. Or, type this command
754 /Library/Privoxy/StartPrivoxy.command
758 You will be prompted for the administrator password.
760 -------------------------------------------------------------------------------
764 Start Privoxy (with RUN <>NIL:) in your startnet script (AmiTCP), in
765 s:user-startup (RoadShow), as startup program in your startup script (Genesis),
766 or as startup action (Miami and MiamiDx). Privoxy will automatically quit when
767 you quit your TCP/IP stack (just ignore the harmless warning your TCP/IP stack
768 may display that Privoxy is still running).
770 -------------------------------------------------------------------------------
774 A script is again used. It will use the file /etc/privoxy/config as its main
777 /etc/init.d/privoxy start
781 Note that Privoxy is not automatically started at boot time by default. You can
782 change this with the rc-update command.
784 rc-update add privoxy default
788 -------------------------------------------------------------------------------
790 5.10. Command Line Options
792 Privoxy may be invoked with the following command-line options:
796 Print version info and exit. Unix only.
800 Print short usage info and exit. Unix only.
804 Don't become a daemon, i.e. don't fork and become process group leader, and
805 don't detach from controlling tty. Unix only.
809 On startup, write the process ID to FILE. Delete the FILE on exit. Failure
810 to create or delete the FILE is non-fatal. If no FILE option is given, no
811 PID file will be used. Unix only.
813 * --user USER[.GROUP]
815 After (optionally) writing the PID file, assume the user ID of USER, and if
816 included the GID of GROUP. Exit if the privileges are not sufficient to do
821 Before changing to the user ID given in the --user option, chroot to that
822 user's home directory, i.e. make the kernel pretend to the Privoxy process
823 that the directory tree starts there. If set up carefully, this can limit
824 the impact of possible vulnerabilities in Privoxy to the files contained in
825 that hierarchy. Unix only.
829 If no configfile is included on the command line, Privoxy will look for a
830 file named "config" in the current directory (except on Win32 where it will
831 look for "config.txt" instead). Specify full path to avoid confusion. If no
832 config file is found, Privoxy will fail to start.
834 -------------------------------------------------------------------------------
836 6. Privoxy Configuration
838 All Privoxy configuration is stored in text files. These files can be edited
839 with a text editor. Many important aspects of Privoxy can also be controlled
840 easily with a web browser.
842 -------------------------------------------------------------------------------
844 6.1. Controlling Privoxy with Your Web Browser
846 Privoxy's user interface can be reached through the special URL http://
847 config.privoxy.org/ (shortcut: http://p.p/), which is a built-in page and works
848 without Internet access. You will see the following section:
851 ? View & change the current configuration
852 ? View the source code version numbers
853 ? View the request headers.
854 ? Look up which actions apply to a URL and why
855 ? Toggle Privoxy on or off
859 This should be self-explanatory. Note the first item leads to an editor for the
860 actions files, which is where the ad, banner, cookie, and URL blocking magic is
861 configured as well as other advanced features of Privoxy. This is an easy way
862 to adjust various aspects of Privoxy configuration. The actions file, and other
863 configuration files, are explained in detail below.
865 "Toggle Privoxy On or Off" is handy for sites that might have problems with
866 your current actions and filters. You can in fact use it as a test to see
867 whether it is Privoxy causing the problem or not. Privoxy continues to run as a
868 proxy in this case, but all manipulation is disabled, i.e. Privoxy acts like a
869 normal forwarding proxy. There is even a toggle Bookmarklet offered, so that
870 you can toggle Privoxy with one click from your browser.
872 -------------------------------------------------------------------------------
874 6.2. Configuration Files Overview
876 For Unix, *BSD and Linux, all configuration files are located in /etc/privoxy/
877 by default. For MS Windows, OS/2, and AmigaOS these are all in the same
878 directory as the Privoxy executable.
880 The installed defaults provide a reasonable starting point, though some
881 settings may be aggressive by some standards. For the time being, the principle
882 configuration files are:
884 * The main configuration file is named config on Linux, Unix, BSD, OS/2, and
885 AmigaOS and config.txt on Windows. This is a required file.
887 * default.action (the main actions file) is used to define which "actions"
888 relating to banner-blocking, images, pop-ups, content modification, cookie
889 handling etc should be applied by default. It also defines many exceptions
890 (both positive and negative) from this default set of actions that enable
891 Privoxy to selectively eliminate the junk, and only the junk, on as many
892 websites as possible.
894 Multiple actions files may be defined in config. These are processed in the
895 order they are defined. Local customizations and locally preferred
896 exceptions to the default policies as defined in default.action (which you
897 will most probably want to define sooner or later) are probably best
898 applied in user.action, where you can preserve them across upgrades.
899 standard.action is for Privoxy's internal use.
901 There is also a web based editor that can be accessed from http://
902 config.privoxy.org/show-status (Shortcut: http://p.p/show-status) for the
903 various actions files.
905 * default.filter (the filter file) can be used to re-write the raw page
906 content, including viewable text as well as embedded HTML and JavaScript,
907 and whatever else lurks on any given web page. The filtering jobs are only
908 pre-defined here; whether to apply them or not is up to the actions files.
909 Only one filter file may be defined.
911 All files use the "#" character to denote a comment (the rest of the line will
912 be ignored) and understand line continuation through placing a backslash ("\")
913 as the very last character in a line. If the # is preceded by a backslash, it
914 looses its special function. Placing a # in front of an otherwise valid
915 configuration line to prevent it from being interpreted is called "commenting
918 The actions files and default.filter can use Perl style regular expressions for
921 After making any changes, there is no need to restart Privoxy in order for the
922 changes to take effect. Privoxy detects such changes automatically. Note,
923 however, that it may take one or two additional requests for the change to take
924 effect. When changing the listening address of Privoxy, these "wake up"
925 requests must obviously be sent to the old listening address.
927 -------------------------------------------------------------------------------
929 7. The Main Configuration File
931 Again, the main configuration file is named config on Linux/Unix/BSD and OS/2,
932 and config.txt on Windows. Configuration lines consist of an initial keyword
933 followed by a list of values, all separated by whitespace (any number of spaces
934 or tabs). For example:
938 Assigns the value /etc/privoxy to the option confdir and thus indicates that
939 the configuration directory is named "/etc/privoxy/".
941 All options in the config file except for confdir and logdir are optional.
942 Watch out in the below description for what happens if you leave them unset.
944 The main config file controls all aspects of Privoxy's operation that are not
945 location dependent (i.e. they apply universally, no matter where you may be
948 -------------------------------------------------------------------------------
950 7.1. Configuration and Log File Locations
952 Privoxy can (and normally does) use a number of other files for additional
953 configuration, help and logging. This section of the configuration file tells
954 Privoxy where to find those other files.
956 The user running Privoxy, must have read permission for all configuration
957 files, and write permission to any files that would be modified, such as log
958 files and actions files.
960 -------------------------------------------------------------------------------
966 The directory where the other configuration files are located
974 /etc/privoxy (Unix) or Privoxy installation dir (Windows)
982 No trailing "/", please
984 When development goes modular and multi-user, the blocker, filter, and
985 per-user config will be stored in subdirectories of "confdir". For now, the
986 configuration directory structure is flat, except for confdir/templates,
987 where the HTML templates for CGI output reside (e.g. Privoxy's 404 error
990 -------------------------------------------------------------------------------
996 The directory where all logging takes place (i.e. where logfile and jarfile
1005 /var/log/privoxy (Unix) or Privoxy installation dir (Windows)
1013 No trailing "/", please
1015 -------------------------------------------------------------------------------
1021 The actions file(s) to use
1025 File name, relative to confdir, without the .action suffix
1029 standard # Internal purposes, no editing recommended
1031 default # Main actions file
1033 user # User customizations
1037 No actions are taken at all. Simple neutral proxying.
1041 Multiple actionsfile lines are permitted, and are in fact recommended!
1043 The default values include standard.action, which is used for internal
1044 purposes and should be loaded, default.action, which is the "main" actions
1045 file maintained by the developers, and user.action, where you can make your
1048 Actions files are where all the per site and per URL configuration is done
1049 for ad blocking, cookie management, privacy considerations, etc. There is
1050 no point in using Privoxy without at least one actions file.
1052 -------------------------------------------------------------------------------
1058 The filter file to use
1062 File name, relative to confdir
1066 default.filter (Unix) or default.filter.txt (Windows)
1070 No textual content filtering takes place, i.e. all +filter{name} actions in
1071 the actions files are turned neutral.
1075 The filter file contains content modification rules that use regular
1076 expressions. These rules permit powerful changes on the content of Web
1077 pages, e.g., you could disable your favorite JavaScript annoyances,
1078 re-write the actual displayed text, or just have some fun replacing
1079 "Microsoft" with "MicroSuck" wherever it appears on a Web page.
1081 The +filter{name} actions rely on the relevant filter (name) to be defined
1084 A pre-defined filter file called default.filter that contains a bunch of
1085 handy filters for common problems is included in the distribution. See the
1086 section on the filter action for a list.
1088 -------------------------------------------------------------------------------
1098 File name, relative to logdir
1102 logfile (Unix) or privoxy.log (Windows)
1106 No log file is used, all log messages go to the console (STDERR).
1110 The logfile is where all logging and error messages are written. The level
1111 of detail and number of messages are set with the debug option (see below).
1112 The logfile can be useful for tracking down a problem with Privoxy (e.g.,
1113 it's not blocking an ad you think it should block) but in most cases you
1114 probably will never look at it.
1116 Your logfile will grow indefinitely, and you will probably want to
1117 periodically remove it. On Unix systems, you can do this with a cron job
1118 (see "man cron"). For Red Hat, a logrotate script has been included.
1120 On SuSE Linux systems, you can place a line like "/var/log/privoxy.* +1024k
1121 644 nobody.nogroup" in /etc/logfiles, with the effect that cron.daily will
1122 automatically archive, gzip, and empty the log, when it exceeds 1M size.
1124 Any log files must be writable by whatever user Privoxy is being run as
1125 (default on UNIX, user id is "privoxy").
1127 -------------------------------------------------------------------------------
1133 The file to store intercepted cookies in
1137 File name, relative to logdir
1141 jarfile (Unix) or privoxy.jar (Windows)
1145 Intercepted cookies are not stored at all.
1149 The jarfile may grow to ridiculous sizes over time.
1151 -------------------------------------------------------------------------------
1157 The trust file to use
1161 File name, relative to confdir
1165 Unset (commented out). When activated: trust (Unix) or trust.txt (Windows)
1169 The entire trust mechanism is turned off.
1173 The trust mechanism is an experimental feature for building white-lists and
1174 should be used with care. It is NOT recommended for the casual user.
1176 If you specify a trust file, Privoxy will only allow access to sites that
1177 are specified in the trustfile. Sites can be listed in one of two ways:
1179 Prepending a ~ character limits access to this site only (and any sub-paths
1180 within this site), e.g. ~www.example.com.
1182 Or, you can designate sites as trusted referrers, by prepending the name
1183 with a + character. The effect is that access to untrusted sites will be
1184 granted -- but only if a link from this trusted referrer was used. The link
1185 target will then be added to the "trustfile" so that future, direct
1186 accesses will be granted. Sites added via this mechanism do not become
1187 trusted referrers themselves (i.e. they are added with a ~ designation).
1189 If you use the + operator in the trust file, it may grow considerably over
1192 It is recommended that Privoxy be compiled with the --disable-force,
1193 --disable-toggle and --disable-editor options, if this feature is to be
1196 Possible applications include limiting Internet access for children.
1198 -------------------------------------------------------------------------------
1200 7.2. Local Set-up Documentation
1202 If you intend to operate Privoxy for more users than just yourself, it might be
1203 a good idea to let them know how to reach you, what you block and why you do
1204 that, your policies, etc.
1206 -------------------------------------------------------------------------------
1212 Location of the Privoxy User Manual.
1216 A fully qualified URI
1224 http://www.privoxy.org/version/user-manual/ will be used, where version is
1225 the Privoxy version.
1229 The User Manual URI is used for help links from some of the internal CGI
1230 pages. The manual itself is normally packaged with the binary
1231 distributions, so you probably want to set this to a locally installed
1232 copy. For multi-user setups, you could provide a copy on a local webserver
1233 for all your users and use the corresponding URL here.
1237 Unix, in local filesystem:
1239 user-manual file:///usr/share/doc/privoxy-3.0.3/user-manual/
1242 Windows, in local filesystem, must use forward slash notation:
1244 user-manual file:/c:/some-dir/privoxy-3.0.3/user-manual/
1247 Windows, UNC notation (with forward slashes):
1249 user-manual file://///some-server/some-path/privoxy-3.0.3/user-manual/
1252 Any platform, on local webserver (called "local-webserver"):
1254 user-manual http://local-webserver/privoxy-user-manual/
1257 +-----------------------------------------------------------------+
1259 |-----------------------------------------------------------------|
1260 |If set, this option should be the first option in the config |
1261 |file, because it is used while the config file is being read. |
1262 +-----------------------------------------------------------------+
1264 -------------------------------------------------------------------------------
1266 7.2.2. trust-info-url
1270 A URL to be displayed in the error page that users will see if access to an
1271 untrusted page is denied.
1279 Two example URL are provided
1283 No links are displayed on the "untrusted" error page.
1287 The value of this option only matters if the experimental trust mechanism
1288 has been activated. (See trustfile above.)
1290 If you use the trust mechanism, it is a good idea to write up some on-line
1291 documentation about your trust policy and to specify the URL(s) here. Use
1292 multiple times for multiple URLs.
1294 The URL(s) should be added to the trustfile as well, so users don't end up
1295 locked out from the information on why they were locked out in the first
1298 -------------------------------------------------------------------------------
1300 7.2.3. admin-address
1304 An email address to reach the proxy administrator.
1316 No email address is displayed on error pages and the CGI user interface.
1320 If both admin-address and proxy-info-url are unset, the whole "Local
1321 Privoxy Support" box on all generated pages will not be shown.
1323 -------------------------------------------------------------------------------
1325 7.2.4. proxy-info-url
1329 A URL to documentation about the local Privoxy setup, configuration or
1342 No link to local documentation is displayed on error pages and the CGI user
1347 If both admin-address and proxy-info-url are unset, the whole "Local
1348 Privoxy Support" box on all generated pages will not be shown.
1350 This URL shouldn't be blocked ;-)
1352 -------------------------------------------------------------------------------
1356 These options are mainly useful when tracing a problem. Note that you might
1357 also want to invoke Privoxy with the --no-daemon command line option when
1360 -------------------------------------------------------------------------------
1366 Key values that determine what information gets logged to the logfile.
1374 12289 (i.e.: URLs plus informational and warning messages)
1378 Nothing gets logged.
1382 The available debug levels are:
1384 debug 1 # show each GET/POST/CONNECT request
1385 debug 2 # show each connection status
1386 debug 4 # show I/O status
1387 debug 8 # show header parsing
1388 debug 16 # log all data into the logfile
1389 debug 32 # debug force feature
1390 debug 64 # debug regular expression filter
1391 debug 128 # debug fast redirects
1392 debug 256 # debug GIF de-animation
1393 debug 512 # Common Log Format
1394 debug 1024 # debug kill pop-ups
1395 debug 2048 # CGI user interface
1396 debug 4096 # Startup banner and warnings.
1397 debug 8192 # Non-fatal errors
1400 To select multiple debug levels, you can either add them or use multiple
1403 A debug level of 1 is informative because it will show you each request as
1404 it happens. 1, 4096 and 8192 are highly recommended so that you will notice
1405 when things go wrong. The other levels are probably only of interest if you
1406 are hunting down a specific problem. They can produce a hell of an output
1409 The reporting of fatal errors (i.e. ones which crash Privoxy) is always on
1410 and cannot be disabled.
1412 If you want to use CLF (Common Log Format), you should set "debug 512" ONLY
1413 and not enable anything else.
1415 -------------------------------------------------------------------------------
1417 7.3.2. single-threaded
1421 Whether to run only one server thread
1433 Multi-threaded (or, where unavailable: forked) operation, i.e. the ability
1434 to serve multiple requests simultaneously.
1438 This option is only there for debug purposes and you should never need to
1439 use it. It will drastically reduce performance.
1441 -------------------------------------------------------------------------------
1443 7.4. Access Control and Security
1445 This section of the config file controls the security-relevant aspects of
1446 Privoxy's configuration.
1448 -------------------------------------------------------------------------------
1450 7.4.1. listen-address
1454 The IP address and TCP port on which Privoxy will listen for client
1467 Bind to 127.0.0.1 (localhost), port 8118. This is suitable and recommended
1468 for home users who run Privoxy on the same machine as their browser.
1472 You will need to configure your browser(s) to this proxy address and port.
1474 If you already have another service running on port 8118, or if you want to
1475 serve requests from other machines (e.g. on your local network) as well,
1476 you will need to override the default.
1478 If you leave out the IP address, Privoxy will bind to all interfaces
1479 (addresses) on your machine and may become reachable from the Internet. In
1480 that case, consider using access control lists (ACL's, see below), and/or a
1483 If you open Privoxy to untrusted users, you will also want to turn off the
1484 enable-edit-actions and enable-remote-toggle options!
1488 Suppose you are running Privoxy on a machine which has the address
1489 192.168.0.1 on your local private network (192.168.0.0) and has another
1490 outside connection with a different address. You want it to serve requests
1493 listen-address 192.168.0.1:8118
1496 -------------------------------------------------------------------------------
1502 Initial state of "toggle" status
1514 Act as if toggled on
1518 If set to 0, Privoxy will start in "toggled off" mode, i.e. behave like a
1519 normal, content-neutral proxy where all ad blocking, filtering, etc are
1520 disabled. See enable-remote-toggle below. This is not really useful
1521 anymore, since toggling is much easier via the web interface than via
1522 editing the conf file.
1524 The windows version will only display the toggle icon in the system tray if
1525 this option is present.
1527 -------------------------------------------------------------------------------
1529 7.4.3. enable-remote-toggle
1533 Whether or not the web-based toggle feature may be used
1545 The web-based toggle feature is disabled.
1549 When toggled off, Privoxy acts like a normal, content-neutral proxy, i.e.
1550 it acts as if none of the actions applied to any URL.
1552 For the time being, access to the toggle feature can not be controlled
1553 separately by "ACLs" or HTTP authentication, so that everybody who can
1554 access Privoxy (see "ACLs" and listen-address above) can toggle it for all
1555 users. So this option is not recommended for multi-user environments with
1558 Note that you must have compiled Privoxy with support for this feature,
1559 otherwise this option has no effect.
1561 -------------------------------------------------------------------------------
1563 7.4.4. enable-edit-actions
1567 Whether or not the web-based actions file editor may be used
1579 The web-based actions file editor is disabled.
1583 For the time being, access to the editor can not be controlled separately
1584 by "ACLs" or HTTP authentication, so that everybody who can access Privoxy
1585 (see "ACLs" and listen-address above) can modify its configuration for all
1586 users. So this option is not recommended for multi-user environments with
1589 Note that you must have compiled Privoxy with support for this feature,
1590 otherwise this option has no effect.
1592 -------------------------------------------------------------------------------
1594 7.4.5. ACLs: permit-access and deny-access
1598 Who can access what.
1602 src_addr[/src_masklen] [dst_addr[/dst_masklen]]
1604 Where src_addr and dst_addr are IP addresses in dotted decimal notation or
1605 valid DNS names, and src_masklen and dst_masklen are subnet masks in CIDR
1606 notation, i.e. integer values from 2 to 30 representing the length (in
1607 bits) of the network address. The masks and the whole destination part are
1616 Don't restrict access further than implied by listen-address
1620 Access controls are included at the request of ISPs and systems
1621 administrators, and are not usually needed by individual users. For a
1622 typical home user, it will normally suffice to ensure that Privoxy only
1623 listens on the localhost (127.0.0.1) or internal (home) network address by
1624 means of the listen-address option.
1626 Please see the warnings in the FAQ that this proxy is not intended to be a
1627 substitute for a firewall or to encourage anyone to defer addressing basic
1628 security weaknesses.
1630 Multiple ACL lines are OK. If any ACLs are specified, then the Privoxy
1631 talks only to IP addresses that match at least one permit-access line and
1632 don't match any subsequent deny-access line. In other words, the last match
1633 wins, with the default being deny-access.
1635 If Privoxy is using a forwarder (see forward below) for a particular
1636 destination URL, the dst_addr that is examined is the address of the
1637 forwarder and NOT the address of the ultimate target. This is necessary
1638 because it may be impossible for the local Privoxy to determine the IP
1639 address of the ultimate target (that's often what gateways are used for).
1641 You should prefer using IP addresses over DNS names, because the address
1642 lookups take time. All DNS names must resolve! You can not use domain
1643 patterns like "*.org" or partial domain names. If a DNS name resolves to
1644 multiple IP addresses, only the first one is used.
1646 Denying access to particular sites by ACL may have undesired side effects
1647 if the site in question is hosted on a machine which also hosts other
1652 Explicitly define the default behavior if no ACL and listen-address are
1653 set: "localhost" is OK. The absence of a dst_addr implies that all
1654 destination addresses are OK:
1656 permit-access localhost
1659 Allow any host on the same class C subnet as www.privoxy.org access to
1660 nothing but www.example.com:
1662 permit-access www.privoxy.org/24 www.example.com/32
1665 Allow access from any host on the 26-bit subnet 192.168.45.64 to anywhere,
1666 with the exception that 192.168.45.73 may not access
1667 www.dirty-stuff.example.com:
1669 permit-access 192.168.45.64/26
1670 deny-access 192.168.45.73 www.dirty-stuff.example.com
1673 -------------------------------------------------------------------------------
1679 Maximum size of the buffer for content filtering.
1691 Use a 4MB (4096 KB) limit.
1695 For content filtering, i.e. the +filter and +deanimate-gif actions, it is
1696 necessary that Privoxy buffers the entire document body. This can be
1697 potentially dangerous, since a server could just keep sending data
1698 indefinitely and wait for your RAM to exhaust -- with nasty consequences.
1701 When a document buffer size reaches the buffer-limit, it is flushed to the
1702 client unfiltered and no further attempt to filter the rest of the document
1703 is made. Remember that there may be multiple threads running, which might
1704 require up to buffer-limit Kbytes each, unless you have enabled
1705 "single-threaded" above.
1707 -------------------------------------------------------------------------------
1711 This feature allows routing of HTTP requests through a chain of multiple
1712 proxies. It can be used to better protect privacy and confidentiality when
1713 accessing specific domains by routing requests to those domains through an
1714 anonymous public proxy (see e.g. http://www.multiproxy.org/anon_list.htm) Or to
1715 use a caching proxy to speed up browsing. Or chaining to a parent proxy may be
1716 necessary because the machine that Privoxy runs on has no direct Internet
1719 Also specified here are SOCKS proxies. Privoxy supports the SOCKS 4 and SOCKS
1722 -------------------------------------------------------------------------------
1728 To which parent HTTP proxy specific requests should be routed.
1732 target_pattern http_parent[:port]
1734 where target_pattern is a URL pattern that specifies to which requests
1735 (i.e. URLs) this forward rule shall apply. Use / to denote "all URLs".
1736 http_parent[:port] is the DNS name or IP address of the parent HTTP proxy
1737 through which the requests should be forwarded, optionally followed by its
1738 listening port (default: 8080). Use a single dot (.) to denote "no
1747 Don't use parent HTTP proxies.
1751 If http_parent is ".", then requests are not forwarded to another HTTP
1752 proxy but are made directly to the web servers.
1754 Multiple lines are OK, they are checked in sequence, and the last match
1759 Everything goes to an example anonymizing proxy, except SSL on port 443
1760 (which it doesn't handle):
1762 forward / anon-proxy.example.org:8080
1766 Everything goes to our example ISP's caching proxy, except for requests to
1769 forward / caching-proxy.example-isp.net:8000
1770 forward .example-isp.net .
1773 -------------------------------------------------------------------------------
1775 7.5.2. forward-socks4 and forward-socks4a
1779 Through which SOCKS proxy (and to which parent HTTP proxy) specific
1780 requests should be routed.
1784 target_pattern socks_proxy[:port] http_parent[:port]
1786 where target_pattern is a URL pattern that specifies to which requests
1787 (i.e. URLs) this forward rule shall apply. Use / to denote "all URLs".
1788 http_parent and socks_proxy are IP addresses in dotted decimal notation or
1789 valid DNS names (http_parent may be "." to denote "no HTTP forwarding"),
1790 and the optional port parameters are TCP ports, i.e. integer values from 1
1799 Don't use SOCKS proxies.
1803 Multiple lines are OK, they are checked in sequence, and the last match
1806 The difference between forward-socks4 and forward-socks4a is that in the
1807 SOCKS 4A protocol, the DNS resolution of the target hostname happens on the
1808 SOCKS server, while in SOCKS 4 it happens locally.
1810 If http_parent is ".", then requests are not forwarded to another HTTP
1811 proxy but are made (HTTP-wise) directly to the web servers, albeit through
1816 From the company example.com, direct connections are made to all "internal"
1817 domains, but everything outbound goes through their ISP's proxy by way of
1818 example.com's corporate SOCKS 4A gateway to the Internet.
1820 forward-socks4a / socks-gw.example.com:1080 www-cache.example-isp.net:8080
1821 forward .example.com .
1824 A rule that uses a SOCKS 4 gateway for all destinations but no HTTP parent
1827 forward-socks4 / socks-gw.example.com:1080 .
1830 -------------------------------------------------------------------------------
1832 7.5.3. Advanced Forwarding Examples
1834 If you have links to multiple ISPs that provide various special content only to
1835 their subscribers, you can configure multiple Privoxies which have connections
1836 to the respective ISPs to act as forwarders to each other, so that your users
1837 can see the internal content of all ISPs.
1839 Assume that host-a has a PPP connection to isp-a.net. And host-b has a PPP
1840 connection to isp-b.net. Both run Privoxy. Their forwarding configuration can
1846 forward .isp-b.net host-b:8118
1852 forward .isp-a.net host-a:8118
1855 Now, your users can set their browser's proxy to use either host-a or host-b
1856 and be able to browse the internal content of both isp-a and isp-b.
1858 If you intend to chain Privoxy and squid locally, then chain as browser ->
1859 squid -> privoxy is the recommended way.
1861 Assuming that Privoxy and squid run on the same box, your squid configuration
1862 could then look like this:
1864 # Define Privoxy as parent proxy (without ICP)
1865 cache_peer 127.0.0.1 parent 8118 7 no-query
1867 # Define ACL for protocol FTP
1870 # Do not forward FTP requests to Privoxy
1871 always_direct allow ftp
1873 # Forward all the rest to Privoxy
1874 never_direct allow all
1877 You would then need to change your browser's proxy settings to squid's address
1878 and port. Squid normally uses port 3128. If unsure consult http_port in
1881 You could just as well decide to only forward requests for Windows executables
1882 through a virus-scanning parent proxy, say, on antivir.example.com, port 8010:
1885 forward /.*\.(exe|com|dll|zip)$ antivir.example.com:8010
1888 -------------------------------------------------------------------------------
1890 7.6. Windows GUI Options
1892 Privoxy has a number of options specific to the Windows GUI interface:
1894 If "activity-animation" is set to 1, the Privoxy icon will animate when
1895 "Privoxy" is active. To turn off, set to 0.
1897 activity-animation 1
1900 If "log-messages" is set to 1, Privoxy will log messages to the console window:
1905 If "log-buffer-size" is set to 1, the size of the log buffer, i.e. the amount
1906 of memory used for the log messages displayed in the console window, will be
1907 limited to "log-max-lines" (see below).
1909 Warning: Setting this to 0 will result in the buffer to grow infinitely and eat
1915 log-max-lines is the maximum number of lines held in the log buffer. See above.
1920 If "log-highlight-messages" is set to 1, Privoxy will highlight portions of the
1921 log messages with a bold-faced font:
1923 log-highlight-messages 1
1926 The font used in the console window:
1928 log-font-name Comic Sans MS
1931 Font size used in the console window:
1936 "show-on-task-bar" controls whether or not Privoxy will appear as a button on
1937 the Task bar when minimized:
1942 If "close-button-minimizes" is set to 1, the Windows close button will minimize
1943 Privoxy instead of closing the program (close with the exit option on the File
1946 close-button-minimizes 1
1949 The "hide-console" option is specific to the MS-Win console version of Privoxy.
1950 If this option is used, Privoxy will disconnect from and hide the command
1956 -------------------------------------------------------------------------------
1960 The actions files are used to define what actions Privoxy takes for which URLs,
1961 and thus determine how ad images, cookies and various other aspects of HTTP
1962 content and transactions are handled, and on which sites (or even parts
1963 thereof). There are three such files included with Privoxy with differing
1966 * default.action - is the primary action file that sets the initial values
1967 for all actions. It is intended to provide a base level of functionality
1968 for Privoxy's array of features. So it is a set of broad rules that should
1969 work reasonably well for users everywhere. This is the file that the
1970 developers are keeping updated, and making available to users.
1972 * user.action - is intended to be for local site preferences and exceptions.
1973 As an example, if your ISP or your bank has specific requirements, and need
1974 special handling, this kind of thing should go here. This file will not be
1977 * standard.action - is used by the web based editor, to set various
1978 pre-defined sets of rules for the default actions section in
1979 default.action. These have increasing levels of aggressiveness and have no
1980 influence on your browsing unless you select them explicitly in the editor.
1981 It is not recommend to edit this file.
1983 The default profiles, and their associated actions, as pre-defined in
1984 standard.action are:
1986 Table 1. Default Configurations
1988 +------------------------------------------------------------+
1989 | Feature | Cautious | Medium |Adventuresome|
1990 |---------------------+-----------+------------+-------------|
1991 |Ad-blocking by URL |yes |yes |yes |
1992 |---------------------+-----------+------------+-------------|
1993 |Ad-filtering by size |yes |yes |yes |
1994 |---------------------+-----------+------------+-------------|
1995 |GIF de-animation |no |yes |yes |
1996 |---------------------+-----------+------------+-------------|
1997 |Referer forging |no |yes |yes |
1998 |---------------------+-----------+------------+-------------|
1999 |Cookie handling |none |session-only|kill |
2000 |---------------------+-----------+------------+-------------|
2001 |Pop-up killing |unsolicited|unsolicited |all |
2002 |---------------------+-----------+------------+-------------|
2003 |Fast redirects |no |no |yes |
2004 |---------------------+-----------+------------+-------------|
2005 |HTML taming |yes |yes |yes |
2006 |---------------------+-----------+------------+-------------|
2007 |JavaScript taming |yes |yes |yes |
2008 |---------------------+-----------+------------+-------------|
2009 |Web-bug killing |yes |yes |yes |
2010 |---------------------+-----------+------------+-------------|
2011 |Fun text replacements|no |no |yes |
2012 |---------------------+-----------+------------+-------------|
2013 |Image tag reordering |no |no |yes |
2014 |---------------------+-----------+------------+-------------|
2015 |Ad-filtering by link |no |no |yes |
2016 |---------------------+-----------+------------+-------------|
2017 |Demoronizer |no |no |yes |
2018 +------------------------------------------------------------+
2020 The list of actions files to be used are defined in the main configuration
2021 file, and are processed in the order they are defined (e.g. default.action is
2022 typically process before user.action). The content of these can all be viewed
2023 and edited from http://config.privoxy.org/show-status.
2025 An actions file typically has multiple sections. If you want to use "aliases"
2026 in an actions file, you have to place the (optional) alias section at the top
2027 of that file. Then comes the default set of rules which will apply universally
2028 to all sites and pages (be very careful with using such a universal set in
2029 user.action or any other actions file after default.action, because it will
2030 override the result from consulting any previous file). And then below that,
2031 exceptions to the defined universal policies. You can regard user.action as an
2032 appendix to default.action, with the advantage that is a separate file, which
2033 makes preserving your personal settings across Privoxy upgrades easier.
2035 Actions can be used to block anything you want, including ads, banners, or just
2036 some obnoxious URL that you would rather not see. Cookies can be accepted or
2037 rejected, or accepted only during the current browser session (i.e. not written
2038 to disk), content can be modified, JavaScripts tamed, user-tracking fooled, and
2039 much more. See below for a complete list of actions.
2041 -------------------------------------------------------------------------------
2043 8.1. Finding the Right Mix
2045 Note that some actions, like cookie suppression or script disabling, may render
2046 some sites unusable that rely on these techniques to work properly. Finding the
2047 right mix of actions is not always easy and certainly a matter of personal
2048 taste. In general, it can be said that the more "aggressive" your default
2049 settings (in the top section of the actions file) are, the more exceptions for
2050 "trusted" sites you will have to make later. If, for example, you want to
2051 crunch all cookies per default, you'll have to make exceptions from that rule
2052 for sites that you regularly use and that require cookies for actually useful
2053 puposes, like maybe your bank, favorite shop, or newspaper.
2055 We have tried to provide you with reasonable rules to start from in the
2056 distribution actions files. But there is no general rule of thumb on these
2057 things. There just are too many variables, and sites are constantly changing.
2058 Sooner or later you will want to change the rules (and read this chapter again
2061 -------------------------------------------------------------------------------
2065 The easiest way to edit the actions files is with a browser by using our
2066 browser-based editor, which can be reached from http://config.privoxy.org/
2067 show-status. The editor allows both fine-grained control over every single
2068 feature on a per-URL basis, and easy choosing from wholesale sets of defaults
2069 like "Cautious", "Medium" or "Adventuresome". Warning: the "Adventuresome"
2070 setting is not only more aggressive, but includes settings that are fun and
2071 subversive, and which some may find of dubious merit!
2073 If you prefer plain text editing to GUIs, you can of course also directly edit
2074 the the actions files. Look at default.action which is richly commented.
2076 -------------------------------------------------------------------------------
2078 8.3. How Actions are Applied to URLs
2080 Actions files are divided into sections. There are special sections, like the "
2081 alias" sections which will be discussed later. For now let's concentrate on
2082 regular sections: They have a heading line (often split up to multiple lines
2083 for readability) which consist of a list of actions, separated by whitespace
2084 and enclosed in curly braces. Below that, there is a list of URL patterns, each
2087 To determine which actions apply to a request, the URL of the request is
2088 compared to all patterns in each action file file. Every time it matches, the
2089 list of applicable actions for the URL is incrementally updated, using the
2090 heading of the section in which the pattern is located. If multiple matches for
2091 the same URL set the same action differently, the last match wins. If not, the
2092 effects are aggregated. E.g. a URL might match a regular section with a heading
2093 line of { +handle-as-image }, then later another one with just { +block },
2094 resulting in both actions to apply.
2096 You can trace this process for any given URL by visiting http://
2097 config.privoxy.org/show-url-info.
2099 More detail on this is provided in the Appendix, Anatomy of an Action.
2101 -------------------------------------------------------------------------------
2105 As mentioned, Privoxy uses "patterns" to determine what actions might apply to
2106 which sites and pages your browser attempts to access. These "patterns" use
2107 wild card type pattern matching to achieve a high degree of flexibility. This
2108 allows one expression to be expanded and potentially match against many similar
2111 Generally, a Privoxy pattern has the form <domain>/<path>, where both the
2112 <domain> and <path> are optional. (This is why the special / pattern matches
2113 all URLs). Note that the protocol portion of the URL pattern (e.g. http://)
2114 should not be included in the pattern. This is assumed already!
2118 is a domain-only pattern and will match any request to www.example.com,
2119 regardless of which document on that server is requested.
2123 means exactly the same. For domain-only patterns, the trailing / may be
2126 www.example.com/index.html
2128 matches only the single document /index.html on www.example.com.
2132 matches the document /index.html, regardless of the domain, i.e. on any web
2137 matches nothing, since it would be interpreted as a domain name and there
2138 is no top-level domain called .html.
2140 -------------------------------------------------------------------------------
2142 8.4.1. The Domain Pattern
2144 The matching of the domain part offers some flexible options: if the domain
2145 starts or ends with a dot, it becomes unanchored at that end. For example:
2149 matches any domain that ENDS in .example.com
2153 matches any domain that STARTS with www.
2157 matches any domain that CONTAINS .example. (Correctly speaking: It matches
2158 any FQDN that contains example as a domain.)
2160 Additionally, there are wild-cards that you can use in the domain names
2161 themselves. They work pretty similar to shell wild-cards: "*" stands for zero
2162 or more arbitrary characters, "?" stands for any single character, you can
2163 define character classes in square brackets and all of that can be freely
2168 matches "adserver.example.com", "ads.example.com", etc but not
2173 matches all of the above, and then some.
2177 matches www.ipix.com, pictures.epix.com, a.b.c.d.e.upix.com etc.
2179 www[1-9a-ez].example.c*
2181 matches www1.example.com, www4.example.cc, wwwd.example.cy,
2182 wwwz.example.com etc., but not wwww.example.com.
2184 -------------------------------------------------------------------------------
2186 8.4.2. The Path Pattern
2188 Privoxy uses Perl compatible regular expressions (through the PCRE library) for
2191 There is an Appendix with a brief quick-start into regular expressions, and
2192 full (very technical) documentation on PCRE regex syntax is available on-line
2193 at http://www.pcre.org/man.txt. You might also find the Perl man page on
2194 regular expressions (man perlre) useful, which is available on-line at http://
2195 www.perldoc.com/perl5.6/pod/perlre.html.
2197 Note that the path pattern is automatically left-anchored at the "/", i.e. it
2198 matches as if it would start with a "^" (regular expression speak for the
2199 beginning of a line).
2201 Please also note that matching in the path is CASE INSENSITIVE by default, but
2202 you can switch to case sensitive at any point in the pattern by using the "(?
2203 -i)" switch: www.example.com/(?-i)PaTtErN.* will match only documents whose
2204 path starts with PaTtErN in exactly this capitalization.
2206 -------------------------------------------------------------------------------
2210 All actions are disabled by default, until they are explicitly enabled
2211 somewhere in an actions file. Actions are turned on if preceded with a "+", and
2212 turned off if preceded with a "-". So a +action means "do that action", e.g.
2213 +block means "please block URLs that match the following patterns", and -block
2214 means "don't block URLs that match the following patterns, even if +block
2215 previously applied."
2217 Again, actions are invoked by placing them on a line, enclosed in curly braces
2218 and separated by whitespace, like in {+some-action -some-other-action
2219 {some-parameter}}, followed by a list of URL patterns, one per line, to which
2220 they apply. Together, the actions line and the following pattern lines make up
2221 a section of the actions file.
2223 There are three classes of actions:
2225 * Boolean, i.e the action can only be "enabled" or "disabled". Syntax:
2227 +name # enable action name
2228 -name # disable action name
2233 * Parameterized, where some value is required in order to enable this type of
2236 +name{param} # enable action and set parameter to param,
2237 # overwriting parameter from previous match if necessary
2238 -name # disable action. The parameter can be omitted
2241 Note that if the URL matches multiple positive forms of a parameterized
2242 action, the last match wins, i.e. the params from earlier matches are
2245 Example: +hide-user-agent{ Mozilla 1.0 }
2247 * Multi-value. These look exactly like parameterized actions, but they behave
2248 differently: If the action applies multiple times to the same URL, but with
2249 different parameters, all the parameters from all matches are remembered.
2250 This is used for actions that can be executed for the same request
2251 repeatedly, like adding multiple headers, or filtering through multiple
2254 +name{param} # enable action and add param to the list of parameters
2255 -name{param} # remove the parameter param from the list of parameters
2256 # If it was the last one left, disable the action.
2257 -name # disable this action completely and remove all parameters from the list
2260 Examples: +add-header{X-Fun-Header: Some text} and +filter{html-annoyances}
2262 If nothing is specified in any actions file, no "actions" are taken. So in this
2263 case Privoxy would just be a normal, non-blocking, non-anonymizing proxy. You
2264 must specifically enable the privacy and blocking features you need (although
2265 the provided default actions files will give a good starting point).
2267 Later defined actions always over-ride earlier ones. So exceptions to any rules
2268 you make, should come in the latter part of the file (or in a file that is
2269 processed later when using multiple actions files). For multi-valued actions,
2270 the actions are applied in the order they are specified. Actions files are
2271 processed in the order they are defined in config (the default installation has
2272 three actions files). It also quite possible for any given URL pattern to match
2273 more than one pattern and thus more than one set of actions!
2275 The list of valid Privoxy actions are:
2277 -------------------------------------------------------------------------------
2283 Confuse log analysis, custom applications
2287 Sends a user defined HTTP header to the web server.
2295 Any string value is possible. Validity of the defined HTTP headers is not
2296 checked. It is recommended that you use the "X-" prefix for custom headers.
2300 This action may be specified multiple times, in order to define multiple
2301 headers. This is rarely needed for the typical user. If you don't know what
2302 "HTTP headers" are, you definitely don't need to worry about this one.
2306 +add-header{X-User-Tracking: sucks}
2309 -------------------------------------------------------------------------------
2315 Block ads or other obnoxious content
2319 Requests for URLs to which this action applies are blocked, i.e. the
2320 requests are not forwarded to the remote server, but answered locally with
2321 a substitute page or image, as determined by the handle-as-image and
2322 set-image-blocker actions.
2334 Privoxy sends a special "BLOCKED" page for requests to blocked pages. This
2335 page contains links to find out why the request was blocked, and a
2336 click-through to the blocked content (the latter only if compiled with the
2337 force feature enabled). The "BLOCKED" page adapts to the available screen
2338 space -- it displays full-blown if space allows, or miniaturized and
2339 text-only if loaded into a small frame or window. If you are using Privoxy
2340 right now, you can take a look at the "BLOCKED" page.
2342 A very important exception occurs if both block and handle-as-image, apply
2343 to the same request: it will then be replaced by an image. If
2344 set-image-blocker (see below) also applies, the type of image will be
2345 determined by its parameter, if not, the standard checkerboard pattern is
2348 It is important to understand this process, in order to understand how
2349 Privoxy deals with ads and other unwanted content.
2351 The filter action can perform a very similar task, by "blocking" banner
2352 images and other content through rewriting the relevant URLs in the
2353 document's HTML source, so they don't get requested in the first place.
2354 Note that this is a totally different technique, and it's easy to confuse
2357 Example usage (section):
2359 {+block} # Block and replace with "blocked" page
2360 .nasty-stuff.example.com
2362 {+block +handle-as-image} # Block and replace with image
2367 -------------------------------------------------------------------------------
2369 8.5.3. crunch-incoming-cookies
2373 Prevent the web server from setting any cookies on your system
2377 Deletes any "Set-Cookie:" HTTP headers from server replies.
2389 This action is only concerned with incoming cookies. For outgoing cookies,
2390 use crunch-outgoing-cookies. Use both to disable cookies completely.
2392 It makes no sense at all to use this action in conjunction with the
2393 session-cookies-only action, since it would prevent the session cookies
2394 from being set. See also filter-content-cookies.
2398 +crunch-incoming-cookies
2401 -------------------------------------------------------------------------------
2403 8.5.4. crunch-outgoing-cookies
2407 Prevent the web server from reading any cookies from your system
2411 Deletes any "Cookie:" HTTP headers from client requests.
2423 This action is only concerned with outgoing cookies. For incoming cookies,
2424 use crunch-incoming-cookies. Use both to disable cookies completely.
2426 It makes no sense at all to use this action in conjunction with the
2427 session-cookies-only action, since it would prevent the session cookies
2432 +crunch-outgoing-cookies
2435 -------------------------------------------------------------------------------
2437 8.5.5. deanimate-gifs
2441 Stop those annoying, distracting animated GIF images.
2445 De-animate GIF animations, i.e. reduce them to their first or last image.
2457 This will also shrink the images considerably (in bytes, not pixels!). If
2458 the option "first" is given, the first frame of the animation is used as
2459 the replacement. If "last" is given, the last frame of the animation is
2460 used instead, which probably makes more sense for most banner animations,
2461 but also has the risk of not showing the entire last frame (if it is only a
2462 delta to an earlier frame).
2464 You can safely use this action with patterns that will also match non-GIF
2465 objects, because no attempt will be made at anything that doesn't look like
2470 +deanimate-gifs{last}
2473 -------------------------------------------------------------------------------
2475 8.5.6. downgrade-http-version
2479 Work around (very rare) problems with HTTP/1.1
2483 Downgrades HTTP/1.1 client requests and server replies to HTTP/1.0.
2495 This is a left-over from the time when Privoxy didn't support important
2496 HTTP/1.1 features well. It is left here for the unlikely case that you
2497 experience HTTP/1.1 related problems with some server out there. Not all
2498 (optional) HTTP/1.1 features are supported yet, so there is a chance you
2499 might need this action.
2501 Example usage (section):
2503 {+downgrade-http-version}
2504 problem-host.example.com
2507 -------------------------------------------------------------------------------
2509 8.5.7. fast-redirects
2513 Fool some click-tracking scripts and speed up indirect links
2517 Cut off all but the last valid URL from requests.
2529 Many sites, like yahoo.com, don't just link to other sites. Instead, they
2530 will link to some script on their own servers, giving the destination as a
2531 parameter, which will then redirect you to the final target. URLs resulting
2532 from this scheme typically look like: http://some.place/click-tracker.cgi?
2533 target=http://some.where.else.
2535 Sometimes, there are even multiple consecutive redirects encoded in the
2536 URL. These redirections via scripts make your web browsing more traceable,
2537 since the server from which you follow such a link can see where you go to.
2538 Apart from that, valuable bandwidth and time is wasted, while your browser
2539 ask the server for one redirect after the other. Plus, it feeds the
2542 This feature is currently not very smart and is scheduled for improvement.
2543 It is likely to break some sites. You should expect to need possibly many
2544 exceptions to this action, if it is enabled by default in default.action.
2545 Some sites just don't work without it.
2552 -------------------------------------------------------------------------------
2558 Get rid of HTML and JavaScript annoyances, banner advertisements (by size),
2559 do fun text replacements, etc.
2563 All files of text-based type, most notably HTML and JavaScript, to which
2564 this action applies, are filtered on-the-fly through the specified regular
2565 expression based substitutions. (Note: as of version 3.0.3 plain text
2566 documents are exempted from filtering, because web servers often use the
2567 text/plain MIME type for all files whose type they don't know.)
2575 The name of a filter, as defined in the filter file (typically
2576 default.filter, set by the filterfile option in the config file). When used
2577 in its negative form, and without parameters, filtering is completely
2582 For your convenience, there are a number of pre-defined filters available
2583 in the distribution filter file that you can use. See the examples below
2586 Filtering requires buffering the page content, which may appear to slow
2587 down page rendering since nothing is displayed until all content has passed
2588 the filters. (It does not really take longer, but seems that way since the
2589 page is not incrementally displayed.) This effect will be more noticeable
2590 on slower connections.
2592 This is very powerful feature, but "rolling your own" filters requires a
2593 knowledge of regular expressions and HTML.
2595 The amount of data that can be filtered is limited to the buffer-limit
2596 option in the main config file. The default is 4096 KB (4 Megs). Once this
2597 limit is exceeded, the buffered data, and all pending data, is passed
2600 Inadequate MIME types, such as zipped files, are not filtered at all.
2601 (Again, only text-based types except plain text). Encrypted SSL data (from
2602 HTTPS servers) cannot be filtered either, since this would violate the
2603 integrity of the secure transaction. In some situations it might be
2604 necessary to protect certain text, like source code, from filtering by
2605 defining appropriate -filter sections.
2607 At this time, Privoxy cannot (yet!) uncompress compressed documents. If you
2608 want filtering to work on all documents, even those that would normally be
2609 sent compressed, use the prevent-compression action in conjunction with
2612 Filtering can achieve some of the same effects as the block action, i.e. it
2613 can be used to block ads and banners. But the mechanism works quite
2614 differently. One effective use, is to block ad banners based on their size
2615 (see below), since many of these seem to be somewhat standardized.
2617 Feedback with suggestions for new or improved filters is particularly
2620 The below list has only the names and a one-line description of each
2621 predefined filter. There are more verbose explanations of what these
2622 filters do in the filter file chapter.
2624 Example usage (with filters from the distribution default.filter file). See the
2625 Predefined Filters section for more explanation on each:
2627 +filter{js-annoyances} # Get rid of particularly annoying JavaScript abuse
2630 +filter{js-events} # Kill all JS event bindings (Radically destructive! Only for extra nasty sites)
2633 +filter{html-annoyances} # Get rid of particularly annoying HTML abuse
2636 +filter{content-cookies} # Kill cookies that come in the HTML or JS content
2639 +filter{refresh-tags} # Kill automatic refresh tags (for dial-on-demand setups)
2642 +filter{unsolicited-popups} # Disable only unsolicited pop-up windows
2645 +filter{all-popups} # Kill all popups in JavaScript and HTML
2648 +filter{img-reorder} # Reorder attributes in <img> tags to make the banners-by-* filters more effective
2651 +filter{banners-by-size} # Kill banners by size
2654 +filter{banners-by-link} # Kill banners by their links to known clicktrackers
2657 +filter{webbugs} # Squish WebBugs (1x1 invisible GIFs used for user tracking)
2660 +filter{tiny-textforms} # Extend those tiny textareas up to 40x80 and kill the hard wrap
2663 +filter{jumping-windows} # Prevent windows from resizing and moving themselves
2666 +filter{frameset-borders} # Give frames a border and make them resizable
2669 +filter{demoronizer} # Fix MS's non-standard use of standard charsets
2672 +filter{shockwave-flash} # Kill embedded Shockwave Flash objects
2675 +filter{quicktime-kioskmode} # Make Quicktime movies saveable
2678 +filter{fun} # Text replacements for subversive browsing fun!
2681 +filter{crude-parental} # Crude parental filtering (demo only)
2684 +filter{ie-exploits} # Disable some known Internet Explorer bug exploits
2687 -------------------------------------------------------------------------------
2689 8.5.9. handle-as-image
2693 Mark URLs as belonging to images (so they'll be replaced by images if they
2698 This action alone doesn't do anything noticeable. It just marks URLs as
2699 images. If the block action also applies, the presence or absence of this
2700 mark decides whether an HTML "blocked" page, or a replacement image (as
2701 determined by the set-image-blocker action) will be sent to the client as a
2702 substitute for the blocked content.
2714 The below generic example section is actually part of default.action. It
2715 marks all URLs with well-known image file name extensions as images and
2716 should be left intact.
2718 Users will probably only want to use the handle-as-image action in
2719 conjunction with block, to block sources of banners, whose URLs don't
2720 reflect the file type, like in the second example section.
2722 Note that you cannot treat HTML pages as images in most cases. For
2723 instance, (in-line) ad frames require an HTML page to be sent, or they
2724 won't display properly. Forcing handle-as-image in this situation will not
2725 replace the ad frame with an image, but lead to error messages.
2727 Example usage (sections):
2729 # Generic image extensions:
2732 /.*\.(gif|jpg|jpeg|png|bmp|ico)$
2734 # These don't look like images, but they're banners and should be
2735 # blocked as images:
2737 {+block +handle-as-image}
2738 some.nasty-banner-server.com/junk.cgi?output=trash
2740 # Banner source! Who cares if they also have non-image content?
2744 -------------------------------------------------------------------------------
2746 8.5.10. hide-forwarded-for-headers
2750 Improve privacy by hiding the true source of the request
2754 Deletes any existing "X-Forwarded-for:" HTTP header from client requests,
2755 and prevents adding a new one.
2767 It is fairly safe to leave this on.
2769 This action is scheduled for improvement: It should be able to generate
2770 forged "X-Forwarded-for:" headers using random IP addresses from a
2771 specified network, to make successive requests from the same client look
2772 like requests from a pool of different users sharing the same proxy.
2776 +hide-forwarded-for-headers
2779 -------------------------------------------------------------------------------
2781 8.5.11. hide-from-header
2785 Keep your (old and ill) browser from telling web servers your email address
2789 Deletes any existing "From:" HTTP header, or replaces it with the specified
2798 Keyword: "block", or any user defined value.
2802 The keyword "block" will completely remove the header (not to be confused
2803 with the block action).
2805 Alternately, you can specify any value you prefer to be sent to the web
2806 server. If you do, it is a matter of fairness not to use any address that
2807 is actually used by a real person.
2809 This action is rarely needed, as modern web browsers don't send "From:"
2814 +hide-from-header{block}
2819 +hide-from-header{spam-me-senseless@sittingduck.example.com}
2822 -------------------------------------------------------------------------------
2824 8.5.12. hide-referrer
2828 Conceal which link you followed to get to a particular site
2832 Deletes the "Referer:" (sic) HTTP header from the client request, or
2833 replaces it with a forged one.
2841 + "block" to delete the header completely.
2843 + "forge" to pretend to be coming from the homepage of the server we are
2846 + Any other string to set a user defined referrer.
2850 "forge" is the preferred option here, since some servers will not send
2851 images back otherwise, in an attempt to prevent their valuable content from
2852 being embedded elsewhere (and hence, without being surrounded by their
2855 hide-referer is an alternate spelling of hide-referrer and the two can be
2856 can be freely substituted with each other. ("referrer" is the correct
2857 English spelling, however the HTTP specification has a bug - it requires it
2858 to be spelled as "referer".)
2862 +hide-referrer{forge}
2867 +hide-referrer{http://www.yahoo.com/}
2870 -------------------------------------------------------------------------------
2872 8.5.13. hide-user-agent
2876 Conceal your type of browser and client operating system
2880 Replaces the value of the "User-Agent:" HTTP header in client requests with
2881 the specified value.
2889 Any user-defined string.
2893 +-----------------------------------------------------------------+
2895 |-----------------------------------------------------------------|
2896 |This breaks many web sites that depend on looking at this header |
2897 |in order to customize their content for different browsers |
2898 |(which, by the way, is NOT a smart way to do that!). |
2899 +-----------------------------------------------------------------+
2901 Using this action in multi-user setups or wherever different types of
2902 browsers will access the same Privoxy is not recommended. In single-user,
2903 single-browser setups, you might use it to delete your OS version
2904 information from the headers, because it is an invitation to exploit known
2905 bugs for your OS. It is also occasionally useful to forge this in order to
2906 access sites that won't let you in otherwise (though there may be a good
2907 reason in some cases). Example of this: some MSN sites will not let Mozilla
2908 enter, yet forging to a Netscape 6.1 user-agent works just fine. (Must be
2909 just a silly MS goof, I'm sure :-).
2911 This action is scheduled for improvement.
2915 +hide-user-agent{Netscape 6.1 (X11; I; Linux 2.4.18 i686)}
2918 -------------------------------------------------------------------------------
2924 Eliminate those annoying pop-up windows (deprecated)
2928 While loading the document, replace JavaScript code that opens pop-up
2929 windows with (syntactically neutral) dummy code on the fly.
2941 This action is basically a built-in, hardwired special-purpose filter
2942 action, but there are important differences: For kill-popups, the document
2943 need not be buffered, so it can be incrementally rendered while
2944 downloading. But kill-popups doesn't catch as many pop-ups as filter
2945 {all-popups} does and is not as smart as filter{unsolicited-popups} is.
2947 Think of it as a fast and efficient replacement for a filter that you can
2948 use if you don't want any filtering at all. Note that it doesn't make sense
2949 to combine it with any filter action, since as soon as one filter applies,
2950 the whole document needs to be buffered anyway, which destroys the
2951 advantage of the kill-popups action over its filter equivalent.
2953 Killing all pop-ups unconditionally is problematic. Many shops and banks
2954 rely on pop-ups to display forms, shopping carts etc, and the filter
2955 {unsolicited-popups} does a fairly good job of catching only the unwanted
2958 If the only kind of pop-ups that you want to kill are exit consoles (those
2959 really nasty windows that appear when you close an other one), you might
2960 want to use filter{js-annoyances} instead.
2967 -------------------------------------------------------------------------------
2969 8.5.15. limit-connect
2973 Prevent abuse of Privoxy as a TCP proxy relay
2977 Specifies to which ports HTTP CONNECT requests are allowable.
2985 A comma-separated list of ports or port ranges (the latter using dashes,
2986 with the minimum defaulting to 0 and the maximum to 65K).
2990 By default, i.e. if no limit-connect action applies, Privoxy only allows
2991 HTTP CONNECT requests to port 443 (the standard, secure HTTPS port). Use
2992 limit-connect if more fine-grained control is desired for some or all
2995 The CONNECT methods exists in HTTP to allow access to secure websites
2996 ("https://" URLs) through proxies. It works very simply: the proxy connects
2997 to the server on the specified port, and then short-circuits its
2998 connections to the client and to the remote server. This can be a big
2999 security hole, since CONNECT-enabled proxies can be abused as TCP relays
3002 If you don't know what any of this means, there probably is no reason to
3003 change this one, since the default is already very restrictive.
3007 +limit-connect{443} # This is the default and need not be specified.
3008 +limit-connect{80,443} # Ports 80 and 443 are OK.
3009 +limit-connect{-3, 7, 20-100, 500-} # Ports less than 3, 7, 20 to 100 and above 500 are OK.
3010 +limit-connect{-} # All ports are OK (gaping security hole!)
3013 -------------------------------------------------------------------------------
3015 8.5.16. prevent-compression
3019 Ensure that servers send the content uncompressed, so it can be passed
3024 Adds a header to the request that asks for uncompressed transfer.
3036 More and more websites send their content compressed by default, which is
3037 generally a good idea and saves bandwidth. But for the filter,
3038 deanimate-gifs and kill-popups actions to work, Privoxy needs access to the
3039 uncompressed data. Unfortunately, Privoxy can't yet(!) uncompress, filter,
3040 and re-compress the content on the fly. So if you want to ensure that all
3041 websites, including those that normally compress, can be filtered, you need
3044 This will slow down transfers from those websites, though. If you use any
3045 of the above-mentioned actions, you will typically want to use
3046 prevent-compression in conjunction with them.
3048 Note that some (rare) ill-configured sites don't handle requests for
3049 uncompressed documents correctly (they send an empty document body). If you
3050 use prevent-compression per default, you'll have to add exceptions for
3051 those sites. See the example for how to do that.
3053 Example usage (sections):
3057 {+prevent-compression}
3060 # Make exceptions for ill sites:
3062 {-prevent-compression}
3064 www.pclinuxonline.com
3067 -------------------------------------------------------------------------------
3069 8.5.17. send-vanilla-wafer
3073 Feed log analysis scripts with useless data.
3077 Sends a cookie with each request stating that you do not accept any
3078 copyright on cookies sent to you, and asking the site operator not to track
3091 The vanilla wafer is a (relatively) unique header and could conceivably be
3094 This action is rarely used and not enabled in the default configuration.
3101 -------------------------------------------------------------------------------
3107 Send custom cookies or feed log analysis scripts with even more useless
3112 Sends a custom, user-defined cookie with each request.
3120 A string of the form "name=value".
3124 Being multi-valued, multiple instances of this action can apply to the same
3125 request, resulting in multiple cookies being sent.
3127 This action is rarely used and not enabled in the default configuration.
3129 Example usage (section):
3131 {+send-wafer{UsingPrivoxy=true}}
3132 my-internal-testing-server.void
3135 -------------------------------------------------------------------------------
3137 8.5.19. session-cookies-only
3141 Allow only temporary "session" cookies (for the current browser session
3146 Deletes the "expires" field from "Set-Cookie:" server headers. Most
3147 browsers will not store such cookies permanently and forget them in between
3160 This is less strict than crunch-incoming-cookies / crunch-outgoing-cookies
3161 and allows you to browse websites that insist or rely on setting cookies,
3162 without compromising your privacy too badly.
3164 Most browsers will not permanently store cookies that have been processed
3165 by session-cookies-only and will forget about them between sessions. This
3166 makes profiling cookies useless, but won't break sites which require
3167 cookies so that you can log in for transactions. This is generally turned
3168 on for all sites, and is the recommended setting.
3170 It makes no sense at all to use session-cookies-only together with
3171 crunch-incoming-cookies or crunch-outgoing-cookies. If you do, cookies will
3174 Note that it is up to the browser how it handles such cookies without an
3175 "expires" field. If you use an exotic browser, you might want to try it out
3178 This setting also has no effect on cookies that may have been stored
3179 previously by the browser before starting Privoxy. These would have to be
3182 Privoxy also uses the content-cookies filter to block some types of
3183 cookies. Content cookies are not effected by session-cookies-only.
3187 +session-cookies-only
3190 -------------------------------------------------------------------------------
3192 8.5.20. set-image-blocker
3196 Choose the replacement for blocked images
3200 This action alone doesn't do anything noticeable. If both block and
3201 handle-as-image also apply, i.e. if the request is to be blocked as an
3202 image, then the parameter of this action decides what will be sent as a
3211 + "pattern" to send a built-in checkerboard pattern image. The image is
3212 visually decent, scales very well, and makes it obvious where banners
3215 + "blank" to send a built-in transparent image. This makes banners
3216 disappear completely, but makes it hard to detect where Privoxy has
3217 blocked images on a given page and complicates troubleshooting if
3218 Privoxy has blocked innocent images, like navigation icons.
3220 + "target-url" to send a redirect to target-url. You can redirect to any
3221 image anywhere, even in your local filesystem (via "file:///" URL).
3223 A good application of redirects is to use special Privoxy-built-in
3224 URLs, which send the built-in images, as target-url. This has the same
3225 visual effect as specifying "blank" or "pattern" in the first place,
3226 but enables your browser to cache the replacement image, instead of
3227 requesting it over and over again.
3231 The URLs for the built-in images are "http://config.privoxy.org/
3232 send-banner?type=type", where type is either "blank" or "pattern".
3234 There is a third (advanced) type, called "auto". It is NOT to be used in
3235 set-image-blocker, but meant for use from filters. Auto will select the
3236 type of image that would have applied to the referring page, had it been an
3243 +set-image-blocker{pattern}
3246 Redirect to the BSD devil:
3248 +set-image-blocker{http://www.freebsd.org/gifs/dae_up3.gif}
3251 Redirect to the built-in pattern for better caching:
3253 +set-image-blocker{http://config.privoxy.org/send-banner?type=pattern}
3256 -------------------------------------------------------------------------------
3260 Note that many of these actions have the potential to cause a page to
3261 misbehave, possibly even not to display at all. There are many ways a site
3262 designer may choose to design his site, and what HTTP header content, and other
3263 criteria, he may depend on. There is no way to have hard and fast rules for all
3264 sites. See the Appendix for a brief example on troubleshooting actions.
3266 -------------------------------------------------------------------------------
3270 Custom "actions", known to Privoxy as "aliases", can be defined by combining
3271 other actions. These can in turn be invoked just like the built-in actions.
3272 Currently, an alias name can contain any character except space, tab, "=", "{"
3273 and "}", but we strongly recommend that you only use "a" to "z", "0" to "9",
3274 "+", and "-". Alias names are not case sensitive, and are not required to start
3275 with a "+" or "-" sign, since they are merely textually expanded.
3277 Aliases can be used throughout the actions file, but they must be defined in a
3278 special section at the top of the file! And there can only be one such section
3279 per actions file. Each actions file may have its own alias section, and the
3280 aliases defined in it are only visible within that file.
3282 There are two main reasons to use aliases: One is to save typing for frequently
3283 used combinations of actions, the other one is a gain in flexibility: If you
3284 decide once how you want to handle shops by defining an alias called "shop",
3285 you can later change your policy on shops in one place, and your changes will
3286 take effect everywhere in the actions file where the "shop" alias is used.
3287 Calling aliases by their purpose also makes your actions files more readable.
3289 Currently, there is one big drawback to using aliases, though: Privoxy's
3290 built-in web-based action file editor honors aliases when reading the actions
3291 files, but it expands them before writing. So the effects of your aliases are
3292 of course preserved, but the aliases themselves are lost when you edit sections
3293 that use aliases with it. This is likely to change in future versions of
3296 Now let's define some aliases...
3298 # Useful custom aliases we can use later.
3300 # Note the (required!) section header line and that this section
3301 # must be at the top of the actions file!
3305 # These aliases just save typing later:
3306 # (Note that some already use other aliases!)
3308 +crunch-all-cookies = +crunch-incoming-cookies +crunch-outgoing-cookies
3309 -crunch-all-cookies = -crunch-incoming-cookies -crunch-outgoing-cookies
3310 block-as-image = +block +handle-as-image
3311 mercy-for-cookies = -crunch-all-cookies -session-cookies-only -filter{content-cookies}
3313 # These aliases define combinations of actions
3314 # that are useful for certain types of sites:
3316 fragile = -block -filter -crunch-all-cookies -fast-redirects -hide-referrer -kill-popups
3317 shop = -crunch-all-cookies -filter{all-popups} -kill-popups
3319 # Short names for other aliases, for really lazy people ;-)
3321 c0 = +crunch-all-cookies
3322 c1 = -crunch-all-cookies
3325 ...and put them to use. These sections would appear in the lower part of an
3326 actions file and define exceptions to the default actions (as specified further
3327 up for the "/" pattern):
3329 # These sites are either very complex or very keen on
3330 # user data and require minimal interference to work:
3333 .office.microsoft.com
3334 .windowsupdate.microsoft.com
3338 # Allow cookies (for setting and retrieving your customer data)
3342 .worldpay.com # for quietpc.com
3345 # These shops require pop-ups:
3347 {shop -kill-popups -filter{all-popups}}
3352 Aliases like "shop" and "fragile" are often used for "problem" sites that
3353 require some actions to be disabled in order to function properly.
3355 -------------------------------------------------------------------------------
3357 8.7. Actions Files Tutorial
3359 The above chapters have shown which actions files there are and how they are
3360 organized, how actions are specified and applied to URLs, how patterns work,
3361 and how to define and use aliases. Now, let's look at an example default.action
3362 and user.action file and see how all these pieces come together:
3364 -------------------------------------------------------------------------------
3366 8.7.1. default.action
3368 Every config file should start with a short comment stating its purpose:
3370 # Sample default.action file <developers@privoxy.org>
3373 Then, since this is the default.action file, the first section is a special
3374 section for internal use that you needn't change or worry about:
3376 ##########################################################################
3377 # Settings -- Don't change! For internal Privoxy use ONLY.
3378 ##########################################################################
3381 for-privoxy-version=3.0
3384 After that comes the (optional) alias section. We'll use the example section
3385 from the above chapter on aliases, that also explains why and how aliases are
3388 ##########################################################################
3390 ##########################################################################
3393 # These aliases just save typing later:
3394 # (Note that some already use other aliases!)
3396 +crunch-all-cookies = +crunch-incoming-cookies +crunch-outgoing-cookies
3397 -crunch-all-cookies = -crunch-incoming-cookies -crunch-outgoing-cookies
3398 block-as-image = +block +handle-as-image
3399 mercy-for-cookies = -crunch-all-cookies -session-cookies-only -filter{content-cookies}
3401 # These aliases define combinations of actions
3402 # that are useful for certain types of sites:
3404 fragile = -block -filter -crunch-all-cookies -fast-redirects -hide-referrer -kill-popups
3405 shop = -crunch-all-cookies -filter{all-popups} -kill-popups
3408 Now come the regular sections, i.e. sets of actions, accompanied by URL
3409 patterns to which they apply. Remember all actions are disabled when matching
3410 starts, so we have to explicitly enable the ones we want.
3412 The first regular section is probably the most important. It has only one
3413 pattern, "/", but this pattern matches all URLs. Therefore, the set of actions
3414 used in this "default" section will be applied to all requests as a start. It
3415 can be partly or wholly overridden by later matches further down this file, or
3416 in user.action, but it will still be largely responsible for your overall
3417 browsing experience.
3419 Again, at the start of matching, all actions are disabled, so there is no real
3420 need to disable any actions here, but we will do that nonetheless, to have a
3421 complete listing for your reference. (Remember: a "+" preceding the action name
3422 enables the action, a "-" disables!). Also note how this long line has been
3423 made more readable by splitting it into multiple lines with line continuation.
3425 ##########################################################################
3426 # "Defaults" section:
3427 ##########################################################################
3431 -crunch-incoming-cookies \
3432 -crunch-outgoing-cookies \
3434 -downgrade-http-version \
3436 +filter{js-annoyances} \
3437 -filter{js-events} \
3438 +filter{html-annoyances} \
3439 -filter{content-cookies} \
3440 +filter{refresh-tags} \
3441 +filter{unsolicited-popups} \
3442 -filter{all-popups} \
3443 +filter{img-reorder} \
3444 +filter{banners-by-size} \
3445 -filter{banners-by-link} \
3447 -filter{tiny-textforms} \
3448 +filter{jumping-windows} \
3449 -filter{frameset-borders} \
3450 -filter{demoronizer} \
3451 -filter{shockwave-flash} \
3452 -filter{quicktime-kioskmode} \
3454 -filter{crude-parental} \
3455 +filter{ie-exploits} \
3457 +hide-forwarded-for-headers \
3458 +hide-from-header{block} \
3459 +hide-referrer{forge} \
3463 +prevent-compression \
3464 -send-vanilla-wafer \
3466 +session-cookies-only \
3467 +set-image-blocker{pattern} \
3469 / # forward slash will match *all* potential URL patterns.
3472 The default behavior is now set. Note that some actions, like not hiding the
3473 user agent, are part of a "general policy" that applies universally and won't
3474 get any exceptions defined later. Other choices, like not blocking (which is
3475 understandably the default!) need exceptions, i.e. we need to specify
3476 explicitly what we want to block in later sections.
3478 The first of our specialized sections is concerned with "fragile" sites, i.e.
3479 sites that require minimum interference, because they are either very complex
3480 or very keen on tracking you (and have mechanisms in place that make them
3481 unusable for people who avoid being tracked). We will simply use our
3482 pre-defined fragile alias instead of stating the list of actions explicitly:
3484 ##########################################################################
3485 # Exceptions for sites that'll break under the default action set:
3486 ##########################################################################
3488 # "Fragile" Use a minimum set of actions for these sites (see alias above):
3491 .office.microsoft.com # surprise, surprise!
3492 .windowsupdate.microsoft.com
3495 Shopping sites are not as fragile, but they typically require cookies to log
3496 in, and pop-up windows for shopping carts or item details. Again, we'll use a
3503 .worldpay.com # for quietpc.com
3508 The fast-redirects action, which we enabled per default above, breaks some
3509 sites. So disable it for popular sites where we know it misbehaves:
3515 .altavista.com/.*(like|url|link):http
3516 .altavista.com/trans.*urltext=http
3520 It is important that Privoxy knows which URLs belong to images, so that if they
3521 are to be blocked, a substitute image can be sent, rather than an HTML page.
3522 Contacting the remote site to find out is not an option, since it would destroy
3523 the loading time advantage of banner blocking, and it would feed the
3524 advertisers (in terms of money and information). We can mark any URL as an
3525 image with the handle-as-image action, and marking all URLs that end in a known
3526 image file extension is a good start:
3528 ##########################################################################
3530 ##########################################################################
3532 # Define which file types will be treated as images, in case they get
3533 # blocked further down this file:
3535 { +handle-as-image }
3536 /.*\.(gif|jpe?g|png|bmp|ico)$
3539 And then there are known banner sources. They often use scripts to generate the
3540 banners, so it won't be visible from the URL that the request is for an image.
3541 Hence we block them and mark them as images in one go, with the help of our
3542 block-as-image alias defined above. (We could of course just as well use +block
3543 +handle-as-image here.) Remember that the type of the replacement image is
3544 chosen by the set-image-blocker action. Since all URLs have matched the default
3545 section with its +set-image-blocker{pattern} action before, it still applies
3546 and needn't be repeated:
3548 # Known ad generators:
3553 .ad.*.doubleclick.net
3554 .a.yimg.com/(?:(?!/i/).)*$
3555 .a[0-9].yimg.com/(?:(?!/i/).)*$
3561 One of the most important jobs of Privoxy is to block banners. A huge bunch of
3562 them are already "blocked" by the filter{banners-by-size} action, which we
3563 enabled above, and which deletes the references to banner images from the pages
3564 while they are loaded, so the browser doesn't request them anymore, and hence
3565 they don't need to be blocked here. But this naturally doesn't catch all
3566 banners, and some people choose not to use filters, so we need a comprehensive
3567 list of patterns for banner URLs here, and apply the block action to them.
3569 First comes a bunch of generic patterns, which do most of the work, by matching
3570 typical domain and path name components of banners. Then comes a list of
3571 individual patterns for specific sites, which is omitted here to keep the
3574 ##########################################################################
3575 # Block these fine banners:
3576 ##########################################################################
3585 /.*count(er)?\.(pl|cgi|exe|dll|asp|php[34]?)
3586 /(?:.*/)?(publicite|werbung|rekla(ma|me|am)|annonse|maino(kset|nta|s)?)/
3588 # Site-specific patterns (abbreviated):
3593 You wouldn't believe how many advertisers actually call their banner servers
3594 ads.company.com, or call the directory in which the banners are stored simply
3595 "banners". So the above generic patterns are surprisingly effective.
3597 But being very generic, they necessarily also catch URLs that we don't want to
3598 block. The pattern .*ads. e.g. catches "nasty-ads.nasty-corp.com" as intended,
3599 but also "downloads.sourcefroge.net" or "adsl.some-provider.net." So here come
3600 some well-known exceptions to the +block section above.
3602 Note that these are exceptions to exceptions from the default! Consider the URL
3603 "downloads.sourcefroge.net": Initially, all actions are deactivated, so it
3604 wouldn't get blocked. Then comes the defaults section, which matches the URL,
3605 but just deactivates the block action once again. Then it matches .*ads., an
3606 exception to the general non-blocking policy, and suddenly +block applies. And
3607 now, it'll match .*loads., where -block applies, so (unless it matches again
3608 further down) it ends up with no block action applying.
3610 ##########################################################################
3611 # Save some innocent victims of the above generic block patterns:
3612 ##########################################################################
3617 adv[io]*. # (for advogato.org and advice.*)
3618 adsl. # (has nothing to do with ads)
3619 ad[ud]*. # (adult.* and add.*)
3620 .edu # (universities don't host banners (yet!))
3621 .*loads. # (downloads, uploads etc)
3629 www.globalintersec.com/adv # (adv = advanced)
3630 www.ugu.com/sui/ugu/adv
3633 Filtering source code can have nasty side effects, so make an exception for our
3634 friends at sourceforge.net, and all paths with "cvs" in them. Note that -filter
3635 disables all filters in one fell swoop!
3637 # Don't filter code!
3644 The actual default.action is of course more comprehensive, but we hope this
3645 example made clear how it works.
3647 -------------------------------------------------------------------------------
3651 So far we are painting with a broad brush by setting general policies, which
3652 would be a reasonable starting point for many people. Now, you might want to be
3653 more specific and have customized rules that are more suitable to your personal
3654 habits and preferences. These would be for narrowly defined situations like
3655 your ISP or your bank, and should be placed in user.action, which is parsed
3656 after all other actions files and hence has the last word, over-riding any
3657 previously defined actions. user.action is also a safe place for your personal
3658 settings, since default.action is actively maintained by the Privoxy developers
3659 and you'll probably want to install updated versions from time to time.
3661 So let's look at a few examples of things that one might typically do in
3664 # My user.action file. <fred@foobar.com>
3667 As aliases are local to the actions file that they are defined in, you can't
3668 use the ones from default.action, unless you repeat them here:
3670 # Aliases are local to the file they are defined in.
3671 # (Re-)define aliases for this file:
3675 # These aliases just save typing later, and the alias names should
3676 # be self explanatory.
3678 +crunch-all-cookies = +crunch-incoming-cookies +crunch-outgoing-cookies
3679 -crunch-all-cookies = -crunch-incoming-cookies -crunch-outgoing-cookies
3680 allow-all-cookies = -crunch-all-cookies -session-cookies-only
3681 allow-popups = -filter{all-popups} -kill-popups
3682 +block-as-image = +block +handle-as-image
3683 -block-as-image = -block
3685 # These aliases define combinations of actions that are useful for
3686 # certain types of sites:
3688 fragile = -block -crunch-all-cookies -filter -fast-redirects -hide-referrer -kill-popups
3689 shop = -crunch-all-cookies allow-popups
3691 # Allow ads for selected useful free sites:
3693 allow-ads = -block -filter{banners-by-size} -filter{banners-by-link}
3696 Say you have accounts on some sites that you visit regularly, and you don't
3697 want to have to log in manually each time. So you'd like to allow persistent
3698 cookies for these sites. The allow-all-cookies alias defined above does exactly
3699 that, i.e. it disables crunching of cookies in any direction, and the
3700 processing of cookies to make them only temporary.
3702 { allow-all-cookies }
3711 Your bank is allergic to some filter, but you don't know which, so you disable
3715 .your-home-banking-site.com
3718 Some file types you may not want to filter for various reasons:
3720 # Technical documentation is likely to contain strings that might
3721 # erroneously get altered by the JavaScript-oriented filters:
3726 # And this stupid host sends streaming video with a wrong MIME type,
3727 # so that Privoxy thinks it is getting HTML and starts filtering:
3729 stupid-server.example.com/
3732 Example of a simple block action. Say you've seen an ad on your favourite page
3733 on example.com that you want to get rid of. You have right-clicked the image,
3734 selected "copy image location" and pasted the URL below while removing the
3735 leading http://, into a { +block } section. Note that { +handle-as-image } need
3736 not be specified, since all URLs ending in .gif will be tagged as images by the
3737 general rules as set in default.action anyway:
3740 www.example.com/nasty-ads/sponsor.gif
3741 another.popular.site.net/more/junk/here/
3744 The URLs of dynamically generated banners, especially from large banner farms,
3745 often don't use the well-known image file name extensions, which makes it
3746 impossible for Privoxy to guess the file type just by looking at the URL. You
3747 can use the +block-as-image alias defined above for these cases. Note that
3748 objects which match this rule but then turn out NOT to be an image are
3749 typically rendered as a "broken image" icon by the browser. Use cautiously.
3757 Now you noticed that the default configuration breaks Forbes Magazine, but you
3758 were too lazy to find out which action is the culprit, and you were again too
3759 lazy to give feedback, so you just used the fragile alias on the site, and --
3760 whoa! -- it worked. The fragile aliases disables those actions that are most
3761 likely to break a site. Also, good for testing purposes to see if it is Privoxy
3762 that is causing the problem or not.
3768 You like the "fun" text replacements in default.filter, but it is disabled in
3769 the distributed actions file. (My colleagues on the team just don't have a
3770 sense of humour, that's why! ;-). So you'd like to turn it on in your private,
3771 update-safe config, once and for all:
3777 Note that the above is not really a good idea: There are exceptions to the
3778 filters in default.action for things that really shouldn't be filtered, like
3779 code on CVS->Web interfaces. Since user.action has the last word, these
3780 exceptions won't be valid for the "fun" filtering specified here.
3782 You might also worry about how your favourite free websites are funded, and
3783 find that they rely on displaying banner advertisements to survive. So you
3784 might want to specifically allow banners for those sites that you feel provide
3793 Note that allow-ads has been aliased to -block, -filter{banners-by-size}, and -
3794 filter{banners-by-link} above.
3796 user.action is generally the best place to define exceptions and additions to
3797 the default policies of default.action. Some actions are safe to have their
3798 default policies set here though. So let's set a default policy to have a
3799 "blank" image as opposed to the checkerboard pattern for ALL sites. "/" of
3800 course matches all URL paths and patterns:
3802 { +set-image-blocker{blank} }
3806 -------------------------------------------------------------------------------
3810 All text substitutions that can be invoked through the filter action must first
3811 be defined in the filter file, which is typically called default.filter and
3812 which can be selected through the filterfile config option.
3814 Typical reasons for doing such substitutions are to eliminate common annoyances
3815 in HTML and JavaScript, such as pop-up windows, exit consoles, crippled windows
3816 without navigation tools, the infamous <BLINK> tag etc, to suppress images with
3817 certain width and height attributes (standard banner sizes or web-bugs), or
3818 just to have fun. The possibilities are endless.
3820 Filtering works on any text-based document type, including HTML, JavaScript,
3821 CSS etc. (all text/* MIME types, except text/plain). Substitutions are made at
3822 the source level, so if you want to "roll your own" filters, you should be
3823 familiar with HTML syntax.
3825 Just like the actions files, the filter file is organized in sections, which
3826 are called filters here. Each filter consists of a heading line, that starts
3827 with the keyword FILTER:, followed by the filter's name, and a short (one line)
3828 description of what it does. Below that line come the jobs, i.e. lines that
3829 define the actual text substitutions. By convention, the name of a filter
3830 should describe what the filter eliminates. The comment is used in the
3831 web-based user interface.
3833 Once a filter called name has been defined in the filter file, it can be
3834 invoked by using an action of the form +filter{name} in any actions file.
3836 A filter header line for a filter called "foo" could look like this:
3838 FILTER: foo Replace all "foo" with "bar"
3841 Below that line, and up to the next header line, come the jobs that define what
3842 text replacements the filter executes. They are specified in a syntax that
3843 imitates Perl's s/// operator. If you are familiar with Perl, you will find
3844 this to be quite intuitive, and may want to look at the PCRS man page for the
3845 subtle differences to Perl behaviour. Most notably, the non-standard option
3846 letter U is supported, which turns the default to ungreedy matching.
3848 If you are new to regular expressions, you might want to take a look at the
3849 Appendix on regular expressions, and see the Perl manual for the s///
3850 operator's syntax and Perl-style regular expressions in general. The below
3851 examples might also help to get you started.
3853 -------------------------------------------------------------------------------
3855 9.1. Filter File Tutorial
3857 Now, let's complete our "foo" filter. We have already defined the heading, but
3858 the jobs are still missing. Since all it does is to replace "foo" with "bar",
3859 there is only one (trivial) job needed:
3864 But wait! Didn't the comment say that all occurrences of "foo" should be
3865 replaced? Our current job will only take care of the first "foo" on each page.
3866 For global substitution, we'll need to add the g option:
3871 Our complete filter now looks like this:
3873 FILTER: foo Replace all "foo" with "bar"
3877 Let's look at some real filters for more interesting examples. Here you see a
3878 filter that protects against some common annoyances that arise from JavaScript
3879 abuse. Let's look at its jobs one after the other:
3881 FILTER: js-annoyances Get rid of particularly annoying JavaScript abuse
3883 # Get rid of JavaScript referrer tracking. Test page: http://www.randomoddness.com/untitled.htm
3885 s|(<script.*)document\.referrer(.*</script>)|$1"Not Your Business!"$2|Usg
3888 Following the header line and a comment, you see the job. Note that it uses |
3889 as the delimiter instead of /, because the pattern contains a forward slash,
3890 which would otherwise have to be escaped by a backslash (\).
3892 Now, let's examine the pattern: it starts with the text <script.* enclosed in
3893 parentheses. Since the dot matches any character, and * means: "Match an
3894 arbitrary number of the element left of myself", this matches "<script",
3895 followed by any text, i.e. it matches the whole page, from the start of the
3898 That's more than we want, but the pattern continues: document\.referrer matches
3899 only the exact string "document.referrer". The dot needed to be escaped, i.e.
3900 preceded by a backslash, to take away its special meaning as a joker, and make
3901 it just a regular dot. So far, the meaning is: Match from the start of the
3902 first <script> tag in a the page, up to, and including, the text
3903 "document.referrer", if both are present in the page (and appear in that
3906 But there's still more pattern to go. The next element, again enclosed in
3907 parentheses, is .*</script>. You already know what .* means, so the whole
3908 pattern translates to: Match from the start of the first <script> tag in a page
3909 to the end of the last <script> tag, provided that the text "document.referrer"
3910 appears somewhere in between.
3912 This is still not the whole story, since we have ignored the options and the
3913 parentheses: The portions of the page matched by sub-patterns that are enclosed
3914 in parentheses, will be remembered and be available through the variables $1,
3915 $2, ... in the substitute. The U option switches to ungreedy matching, which
3916 means that the first .* in the pattern will only "eat up" all text in between "
3917 <script" and the first occurrence of "document.referrer", and that the second
3918 .* will only span the text up to the first "</script>" tag. Furthermore, the s
3919 option says that the match may span multiple lines in the page, and the g
3920 option again means that the substitution is global.
3922 So, to summarize, the pattern means: Match all scripts that contain the text
3923 "document.referrer". Remember the parts of the script from (and including) the
3924 start tag up to (and excluding) the string "document.referrer" as $1, and the
3925 part following that string, up to and including the closing tag, as $2.
3927 Now the pattern is deciphered, but wasn't this about substituting things? So
3928 lets look at the substitute: $1"Not Your Business!"$2 is easy to read: The text
3929 remembered as $1, followed by "Not Your Business!" (including the quotation
3930 marks!), followed by the text remembered as $2. This produces an exact copy of
3931 the original string, with the middle part (the "document.referrer") replaced by
3932 "Not Your Business!".
3934 The whole job now reads: Replace "document.referrer" by "Not Your Business!"
3935 wherever it appears inside a <script> tag. Note that this job won't break
3936 JavaScript syntax, since both the original and the replacement are
3937 syntactically valid string objects. The script just won't have access to the
3938 referrer information anymore.
3940 We'll show you two other jobs from the JavaScript taming department, but this
3941 time only point out the constructs of special interest:
3943 # The status bar is for displaying link targets, not pointless blahblah
3945 s/window\.status\s*=\s*(['"]).*?\1/dUmMy=1/ig
3948 \s stands for whitespace characters (space, tab, newline, carriage return, form
3949 feed), so that \s* means: "zero or more whitespace". The ? in .*? makes this
3950 matching of arbitrary text ungreedy. (Note that the U option is not set). The
3951 ['"] construct means: "a single or a double quote". Finally, \1 is a
3952 backreference to the first parenthesis just like $1 above, with the difference
3953 that in the pattern, a backslash indicates a backreference, whereas in the
3954 substitute, it's the dollar.
3956 So what does this job do? It replaces assignments of single- or double-quoted
3957 strings to the "window.status" object with a dummy assignment (using a variable
3958 name that is hopefully odd enough not to conflict with real variables in
3959 scripts). Thus, it catches many cases where e.g. pointless descriptions are
3960 displayed in the status bar instead of the link target when you move your mouse
3963 # Kill OnUnload popups. Yummy. Test: http://www.zdnet.com/zdsubs/yahoo/tree/yfs.html
3965 s/(<body [^>]*)onunload(.*>)/$1never$2/iU
3968 Including the OnUnload event binding in the HTML DOM was a CRIME. When I close
3969 a browser window, I want it to close and die. Basta. This job replaces the
3970 "onunload" attribute in "<body>" tags with the dummy word never. Note that the
3971 i option makes the pattern matching case-insensitive. Also note that ungreedy
3972 matching alone doesn't always guarantee a minimal match: In the first
3973 parenthesis, we had to use [^>]* instead of .* to prevent the match from
3974 exceeding the <body> tag if it doesn't contain "OnUnload", but the page's
3977 The last example is from the fun department:
3979 FILTER: fun Fun text replacements
3981 # Spice the daily news:
3983 s/microsoft(?!\.com)/MicroSuck/ig
3986 Note the (?!\.com) part (a so-called negative lookahead) in the job's pattern,
3987 which means: Don't match, if the string ".com" appears directly following
3988 "microsoft" in the page. This prevents links to microsoft.com from being
3989 trashed, while still replacing the word everywhere else.
3991 # Buzzword Bingo (example for extended regex syntax)
3993 s* industry[ -]leading \
3995 | customer[ -]focused \
3996 | market[ -]driven \
3997 | award[ -]winning # Comments are OK, too! \
3998 | high[ -]performance \
3999 | solutions[ -]based \
4003 *<font color="red"><b>BINGO!</b></font> \
4007 The x option in this job turns on extended syntax, and allows for e.g. the
4008 liberal use of (non-interpreted!) whitespace for nicer formatting.
4012 -------------------------------------------------------------------------------
4014 9.2. The Pre-defined Filters
4016 The distribution default.filter file contains a selection of pre-defined
4017 filters for your convenience:
4021 The purpose of this filter is to get rid of particularly annoying
4022 JavaScript abuse. To that end, it
4024 + replaces JavaScript references to the browser's referrer information
4025 with the string "Not Your Business!". This compliments the
4026 hide-referrer action on the content level.
4028 + removes the bindings to the DOM's unload event which we feel has no
4029 right to exist and is responsible for most "exit consoles", i.e. nasty
4030 windows that pop up when you close another one.
4032 + removes code that causes new windows to be opened with undesired
4033 properties, such as being full-screen, non-resizable, without location,
4034 status or menu bar etc.
4038 This is a very radical measure. It removes virtually all JavaScript event
4039 bindings, which means that scripts can not react to user actions such as
4040 mouse movements or clicks, window resizing etc, anymore.
4042 We strongly discourage using this filter as a default since it breaks many
4043 legitimate scripts. It is meant for use only on extra-nasty sites (should
4044 you really need to go there).
4048 This filter will undo many common instances of HTML based abuse.
4050 The BLINK and MARQUEE tags are neutralized (yeah baby!), and browser
4051 windows will be created as resizable (as of course they should be!), and
4052 will have location, scroll and menu bars -- even if specified otherwise.
4056 Most cookies are set in the HTTP dialogue, where they can be intercepted by
4057 the crunch-incoming-cookies and crunch-outgoing-cookies actions. But web
4058 sites increasingly make use of HTML meta tags and JavaScript to sneak
4059 cookies to the browser on the content level.
4061 This filter disables HTML and JavaScript code that reads or sets cookies.
4062 Use it wherever you would also use the cookie crunch actions.
4066 Disable any refresh tags if the interval is greater than nine seconds (so
4067 that redirections done via refresh tags are not destroyed). This is useful
4068 for dial-on-demand setups, or for those who find this HTML feature
4073 This filter attempts to prevent only "unsolicited" pop-up windows from
4074 opening, yet still allow pop-up windows that the user has explicitly chosen
4075 to open. It was added in version 3.0.1, as an improvement over earlier such
4078 Technical note: The filter works by redefining the window.open JavaScript
4079 function to a dummy function during the loading and rendering phase of each
4080 HTML page access, and restoring the function afterwards.
4084 Attempt to prevent all pop-up windows from opening. Note this should be
4085 used with more discretion than the above, since it is more likely to break
4086 some sites that require pop-ups for normal usage. Use with caution.
4090 This is a helper filter that has no value if used alone. It makes the
4091 banners-by-size and banners-by-link (see below) filters more effective and
4092 should be enabled together with them.
4096 This filter removes image tags purely based on what size they are.
4097 Fortunately for us, many ads and banner images tend to conform to certain
4098 standardized sizes, which makes this filter quite effective for ad
4101 Occasionally this filter will cause false positives on images that are not
4102 ads, but just happen to be of one of the standard banner sizes.
4106 This is an experimental filter that attempts to kill any banners if their
4107 URLs seem to point to known or suspected click trackers. It is currently
4108 not of much value and is not recommended for use by default.
4112 Webbugs are small, invisible images (technically 1X1 GIF images), that are
4113 used to track users across websites, and collect information on them. As an
4114 HTML page is loaded by the browser, an embedded image tag causes the
4115 browser to contact a third-party site, disclosing the tracking information
4116 through the requested URL and/or cookies for that third-party domain,
4117 without the use ever becoming aware of the interaction with the third-party
4118 site. HTML-ized spam also uses a similar technique to verify email
4121 This filter removes the HTML code that loads such "webbugs".
4125 A rather special-purpose filter that can be used to enlarge textareas
4126 (those multi-line text boxes in web forms) and turn off hard word wrap in
4127 them. It was written for the sourceforge.net tracker system where such
4128 boxes are a nuisance, but it can be handy on other sites, too.
4130 It is not recommended to use this filter as a default.
4134 Many consider windows that move, or resize themselves to be abusive. This
4135 filter neutralizes the related JavaScript code. Note that some sites might
4136 not display or behave as intended when using this filter.
4140 Some web designers seem to assume that everyone in the world will view
4141 their web sites using the same browser brand and version, screen resolution
4142 etc, because only that assumption could explain why they'd use static frame
4143 sizes, yet prevent their frames from being resized by the user, should they
4144 be too small to show their whole content.
4146 This filter removes the related HTML code. It should only be applied to
4147 sites which need it.
4151 Many Microsoft products that generate HTML use non-standard extensions
4152 (read: violations) of the ISO 8859-1 aka Latin-1 character set. This causes
4153 those HTML documents to display with errors on standard-compliant
4156 This filter translates the MS-only characters into Latin-1 equivalents. It
4157 is not necessary when using MS products, and will cause corruption of all
4158 documents that use 8-bit character sets other than Latin-1. It's mostly
4159 worthwhile for Europeans on non-MS platforms, if wierd garbage characters
4160 sometimes appear on some pages.
4164 A filter for shockwave haters. As the name suggests, this filter strips
4165 code out of web pages that is used to embed shockwave flash objects.
4169 Change HTML code that embeds Quicktime objects so that kioskmode, which
4170 prevents saving, is disabled.
4174 Text replacements for subversive browsing fun. Make fun of your favorite
4175 Monopolist or play buzzword bingo.
4179 A demonstration-only filter that shows how Privoxy can be used to delete
4180 web content on a keyword basis.
4184 A collection of text replacements to disable malicious HTML and JavaScript
4185 code that exploits known security holes in Internet Explorer.
4187 Presently, it only protects against Nimda and a cross-site scripting bug,
4188 and would need active maintenance to provide more substantial protection.
4192 Some web sites have very specific problems, the cure for which doesn't
4193 apply anywhere else, or could even cause damage on other sites.
4195 This is a collection of such site-specific cures which should only be
4196 applied to the sites they were intended for, which is what the supplied
4197 default.action file does. Users shouldn't need to change anything regarding
4200 -------------------------------------------------------------------------------
4204 All Privoxy built-in pages, i.e. error pages such as the "404 - No Such Domain"
4205 error page, the "BLOCKED" page and all pages of its web-based user interface,
4206 are generated from templates. (Privoxy must be running for the above links to
4209 These templates are stored in a subdirectory of the configuration directory
4210 called templates. On Unixish platforms, this is typically /etc/privoxy/
4213 The templates are basically normal HTML files, but with place-holders (called
4214 symbols or exports), which Privoxy fills at run time. You can edit the
4215 templates with a normal text editor, should you want to customize them. (Not
4216 recommended for the casual user). Note that just like in configuration files,
4217 lines starting with # are ignored when the templates are filled in.
4219 The place-holders are of the form @name@, and you will find a list of available
4220 symbols, which vary from template to template, in the comments at the start of
4221 each file. Note that these comments are not always accurate, and that it's
4222 probably best to look at the existing HTML code to find out which symbols are
4223 supported and what they are filled in with.
4225 A special application of this substitution mechanism is to make whole blocks of
4226 HTML code disappear when a specific symbol is set. We use this for many
4227 purposes, one of them being to include the beta warning in all our user
4228 interface (CGI) pages when Privoxy in in an alpha or beta development stage:
4230 <!-- @if-unstable-start -->
4232 ... beta warning HTML code goes here ...
4234 <!-- if-unstable-end@ -->
4237 If the "unstable" symbol is set, everything in between and including
4238 @if-unstable-start and if-unstable-end@ will disappear, leaving nothing but an
4244 There's also an if-then-else construct and an #include mechanism, but you'll
4245 sure find out if you are inclined to edit the templates ;-)
4247 All templates refer to a style located at http://config.privoxy.org/
4248 send-stylesheet. This is, of course, locally served by Privoxy and the source
4249 for it can be found and edited in the cgi-style.css template.
4251 -------------------------------------------------------------------------------
4253 11. Contacting the Developers, Bug Reporting and Feature Requests
4255 We value your feedback. In fact, we rely on it to improve Privoxy and its
4256 configuration. However, please note the following hints, so we can provide you
4257 with the best support:
4259 -------------------------------------------------------------------------------
4263 For casual users, our support forum at SourceForge is probably best suited:
4264 http://sourceforge.net/tracker/?group_id=11118&atid=211118
4266 All users are of course welcome to discuss their issues on the users mailing
4267 list, where the developers also hang around.
4269 -------------------------------------------------------------------------------
4273 Please report all bugs only through our bug tracker: http://sourceforge.net/
4274 tracker/?group_id=11118&atid=111118.
4276 Before doing so, please make sure that the bug has not already been submitted
4277 and observe the additional hints at the top of the submit form.
4279 Please try to verify that it is a Privoxy bug, and not a browser or site bug
4280 first. If unsure, try toggling off Privoxy, and see if the problem persists.
4281 The appendix of the user manual also has helpful information on action
4282 debugging. If you are using your own custom configuration, please try the stock
4283 configs to see if the problem is configuration related.
4285 If not using the latest version, chances are that the bug has been found and
4286 fixed in the meantime. We would appreciate if you could take the time to
4287 upgrade to the latest version (or even the latest CVS snapshot) and verify your
4288 bug, but this is not required for reporting.
4290 -------------------------------------------------------------------------------
4292 11.3. Request New Features
4294 You are welcome to submit ideas on new features or other proposals for
4295 improvement through our feature request tracker at http://sourceforge.net/
4296 tracker/?atid=361118&group_id=11118.
4298 -------------------------------------------------------------------------------
4300 11.4. Report Ads or Other Actions-Related Problems
4302 Please send feedback on ads that slipped through, innocent images that were
4303 blocked, and any other problems relating to the default.action file through our
4304 actions feedback mechanism located at http://www.privoxy.org/actions/. On this
4305 page, you will also find a bookmark which will take you back there from any
4306 troubled site and even pre-fill the form!
4308 New, improved default.action files will occasionally be made available based on
4309 your feedback. These will be announced on the ijbswa-announce list and
4310 available from our the files section of our project page.
4312 -------------------------------------------------------------------------------
4316 For any other issues, feel free to use the mailing lists. Technically
4317 interested users and people who wish to contribute to the project are also
4318 welcome on the developers list! You can find an overview of all Privoxy-related
4319 mailing lists, including list archives, at: http://sourceforge.net/mail/?
4322 -------------------------------------------------------------------------------
4324 12. Privoxy Copyright, License and History
4326 Copyright © 2001 - 2004 by Privoxy Developers <developers@privoxy.org>
4328 Some source code is based on code Copyright © 1997 by Anonymous Coders and
4329 Junkbusters, Inc. and licensed under the GNU General Public License.
4331 -------------------------------------------------------------------------------
4335 Privoxy is free software; you can redistribute it and/or modify it under the
4336 terms of the GNU General Public License, version 2, as published by the Free
4337 Software Foundation.
4339 This program is distributed in the hope that it will be useful, but WITHOUT ANY
4340 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
4341 PARTICULAR PURPOSE. See the GNU General Public License for more details, which
4342 is available from the Free Software Foundation, Inc, 59 Temple Place - Suite
4343 330, Boston, MA 02111-1307, USA.
4345 You should have received a copy of the GNU General Public License along with
4346 this program; if not, write to the
4349 Foundation, Inc. 59 Temple Place - Suite 330
4350 Boston, MA 02111-1307
4353 -------------------------------------------------------------------------------
4357 In the beginning, there was the Internet Junkbuster, by Anonymous Coders and
4358 Junkbusters Corporation. It saved many users a lot of pain in the early days of
4359 web advertising and user tracking.
4361 But the web, its protocols and standards, and with it, the techniques for
4362 forcing users to consume ads, give up autonomy over their browsing, and for
4363 spying on them, kept evolving. Unfortunately, the Internet Junkbuster did not.
4364 Version 2.0.2, published in 1998, was (and is) the last official release
4365 available from Junkbusters Corporation. Fortunately, it had been released under
4366 the GNU GPL, which allowed further development by others.
4368 So Stefan Waldherr started maintaining an improved version of the software, to
4369 which eventually a number of people contributed patches. It could already
4370 replace banners with a transparent image, and had a first version of pop-up
4371 killing, but it was still very closely based on the original, with all its
4372 limitations, such as the lack of HTTP/1.1 support, flexible per-site
4373 configuration, or content modification. The last release from this effort was
4374 version 2.0.2-10, published in 2000.
4376 Then, some developers picked up the thread, and started turning the software
4377 inside out, upside down, and then reassembled it, adding many new features
4380 The result of this is Privoxy, whose first stable version, 3.0, was released
4383 -------------------------------------------------------------------------------
4387 Current Developement Team:
4391 David Schmidt (OS/2, Mac OSX ports)
4395 Current and Former Project Contributors:
4398 Rodrigo Barbosa (RPM specfiles)
4403 Karsten Hopp (Red Hat)
4410 Roland Rosenfeld (Debian)
4411 Georg Sauthoff (Gentoo)
4413 Joerg Strohmayer (Amiga)
4419 Based in part on code originally developed by:
4424 Thanks to the many people who have tested Privoxy, reported bugs, or made
4425 suggestions. These include (in alphabetical order):
4447 -------------------------------------------------------------------------------
4451 Other references and sites of interest to Privoxy users:
4453 http://www.privoxy.org/, the Privoxy Home page.
4455 http://www.privoxy.org/faq/, the Privoxy FAQ.
4457 http://sourceforge.net/projects/ijbswa/, the Project Page for Privoxy on
4460 http://config.privoxy.org/, the web-based user interface. Privoxy must be
4461 running for this to work. Shortcut: http://p.p/
4463 http://www.privoxy.org/actions/, to submit "misses" to the developers.
4465 http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/ijbswa/contrib/, cool and fun
4466 ideas from Privoxy users.
4468 http://www.junkbusters.com/ht/en/cookies.html, an explanation how cookies are
4469 used to track web users.
4471 http://www.junkbusters.com/ijb.html, the original Internet Junkbuster.
4473 http://www.waldherr.org/junkbuster/, Stefan Waldherr's version of Junkbuster,
4474 from which Privoxy was derived.
4476 http://privacy.net/analyze/, a useful site to check what information about you
4477 is leaked while you browse the web.
4479 http://www.squid-cache.org/, a very popular caching proxy, which is often used
4480 together with Privoxy.
4482 http://www.privoxy.org/developer-manual/, the Privoxy developer manual.
4484 -------------------------------------------------------------------------------
4488 14.1. Regular Expressions
4490 Privoxy uses Perl-style "regular expressions" in its actions files and filter
4491 file, through the PCRE and PCRS libraries.
4493 If you are reading this, you probably don't understand what "regular
4494 expressions" are, or what they can do. So this will be a very brief
4495 introduction only. A full explanation would require a book ;-)
4497 Regular expressions provide a language to describe patterns that can be run
4498 against strings of characters (letter, numbers, etc), to see if they match the
4499 string or not. The patterns are themselves (sometimes complex) strings of
4500 literal characters, combined with wild-cards, and other special characters,
4501 called meta-characters. The "meta-characters" have special meanings and are
4502 used to build complex patterns to be matched against. Perl Compatible Regular
4503 Expressions are an especially convenient "dialect" of the regular expression
4506 To make a simple analogy, we do something similar when we use wild-card
4507 characters when listing files with the dir command in DOS. *.* matches all
4508 filenames. The "special" character here is the asterisk which matches any and
4509 all characters. We can be more specific and use ? to match just individual
4510 characters. So "dir file?.text" would match "file1.txt", "file2.txt", etc. We
4511 are pattern matching, using a similar technique to "regular expressions"!
4513 Regular expressions do essentially the same thing, but are much, much more
4514 powerful. There are many more "special characters" and ways of building complex
4515 patterns however. Let's look at a few of the common ones, and then some
4518 . - Matches any single character, e.g. "a", "A", "4", ":", or "@".
4520 ? - The preceding character or expression is matched ZERO or ONE times. Either/
4523 + - The preceding character or expression is matched ONE or MORE times.
4525 * - The preceding character or expression is matched ZERO or MORE times.
4527 \ - The "escape" character denotes that the following character should be taken
4528 literally. This is used where one of the special characters (e.g. ".") needs to
4529 be taken literally and not as a special meta-character. Example: "example
4530 \.com", makes sure the period is recognized only as a period (and not expanded
4531 to its meta-character meaning of any single character).
4533 [] - Characters enclosed in brackets will be matched if any of the enclosed
4534 characters are encountered. For instance, "[0-9]" matches any numeric digit
4535 (zero through nine). As an example, we can combine this with "+" to match any
4536 digit one of more times: "[0-9]+".
4538 () - parentheses are used to group a sub-expression, or multiple
4541 | - The "bar" character works like an "or" conditional statement. A match is
4542 successful if the sub-expression on either side of "|" matches. As an example:
4543 "/(this|that) example/" uses grouping and the bar character and would match
4544 either "this example" or "that example", and nothing else.
4546 These are just some of the ones you are likely to use when matching URLs with
4547 Privoxy, and is a long way from a definitive list. This is enough to get us
4548 started with a few simple examples which may be more illuminating:
4550 /.*/banners/.* - A simple example that uses the common combination of "." and
4551 "*" to denote any character, zero or more times. In other words, any string at
4552 all. So we start with a literal forward slash, then our regular expression
4553 pattern (".*") another literal forward slash, the string "banners", another
4554 forward slash, and lastly another ".*". We are building a directory path here.
4555 This will match any file with the path that has a directory named "banners" in
4556 it. The ".*" matches any characters, and this could conceivably be more forward
4557 slashes, so it might expand into a much longer looking path. For example, this
4558 could match: "/eye/hate/spammers/banners/annoy_me_please.gif", or just "/
4559 banners/annoying.html", or almost an infinite number of other possible
4560 combinations, just so it has "banners" in the path somewhere.
4562 A now something a little more complex:
4564 /.*/adv((er)?ts?|ertis(ing|ements?))?/ - We have several literal forward
4565 slashes again ("/"), so we are building another expression that is a file path
4566 statement. We have another ".*", so we are matching against any conceivable
4567 sub-path, just so it matches our expression. The only true literal that must
4568 match our pattern is adv, together with the forward slashes. What comes after
4569 the "adv" string is the interesting part.
4571 Remember the "?" means the preceding expression (either a literal character or
4572 anything grouped with "(...)" in this case) can exist or not, since this means
4573 either zero or one match. So "((er)?ts?|ertis(ing|ements?))" is optional, as
4574 are the individual sub-expressions: "(er)", "(ing|ements?)", and the "s". The "
4575 |" means "or". We have two of those. For instance, "(ing|ements?)", can expand
4576 to match either "ing" OR "ements?". What is being done here, is an attempt at
4577 matching as many variations of "advertisement", and similar, as possible. So
4578 this would expand to match just "adv", or "advert", or "adverts", or
4579 "advertising", or "advertisement", or "advertisements". You get the idea. But
4580 it would not match "advertizements" (with a "z"). We could fix that by changing
4581 our regular expression to: "/.*/adv((er)?ts?|erti(s|z)(ing|ements?))?/", which
4582 would then match either spelling.
4584 /.*/advert[0-9]+\.(gif|jpe?g) - Again another path statement with forward
4585 slashes. Anything in the square brackets "[]" can be matched. This is using
4586 "0-9" as a shorthand expression to mean any digit one through nine. It is the
4587 same as saying "0123456789". So any digit matches. The "+" means one or more of
4588 the preceding expression must be included. The preceding expression here is
4589 what is in the square brackets -- in this case, any digit one through nine.
4590 Then, at the end, we have a grouping: "(gif|jpe?g)". This includes a "|", so
4591 this needs to match the expression on either side of that bar character also. A
4592 simple "gif" on one side, and the other side will in turn match either "jpeg"
4593 or "jpg", since the "?" means the letter "e" is optional and can be matched
4594 once or not at all. So we are building an expression here to match image GIF or
4595 JPEG type image file. It must include the literal string "advert", then one or
4596 more digits, and a "." (which is now a literal, and not a special character,
4597 since it is escaped with "\"), and lastly either "gif", or "jpeg", or "jpg".
4598 Some possible matches would include: "//advert1.jpg", "/nasty/ads/
4599 advert1234.gif", "/banners/from/hell/advert99.jpg". It would not match
4600 "advert1.gif" (no leading slash), or "/adverts232.jpg" (the expression does not
4601 include an "s"), or "/advert1.jsp" ("jsp" is not in the expression anywhere).
4603 We are barely scratching the surface of regular expressions here so that you
4604 can understand the default Privoxy configuration files, and maybe use this
4605 knowledge to customize your own installation. There is much, much more that can
4606 be done with regular expressions. Now that you know enough to get started, you
4607 can learn more on your own :/
4609 More reading on Perl Compatible Regular expressions: http://www.perldoc.com/
4610 perl5.6/pod/perlre.html
4612 For information on regular expression based substitutions and their
4613 applications in filters, please see the filter file tutorial in this manual.
4615 -------------------------------------------------------------------------------
4617 14.2. Privoxy's Internal Pages
4619 Since Privoxy proxies each requested web page, it is easy for Privoxy to trap
4620 certain special URLs. In this way, we can talk directly to Privoxy, and see how
4621 it is configured, see how our rules are being applied, change these rules and
4622 other configuration options, and even turn Privoxy's filtering off, all with a
4625 The URLs listed below are the special ones that allow direct access to Privoxy.
4626 Of course, Privoxy must be running to access these. If not, you will get a
4627 friendly error message. Internet access is not necessary either.
4629 * Privoxy main page:
4631 http://config.privoxy.org/
4633 There is a shortcut: http://p.p/ (But it doesn't provide a fall-back to a
4634 real page, in case the request is not sent through Privoxy)
4636 * Show information about the current configuration, including viewing and
4637 editing of actions files:
4639 http://config.privoxy.org/show-status
4641 * Show the source code version numbers:
4643 http://config.privoxy.org/show-version
4645 * Show the browser's request headers:
4647 http://config.privoxy.org/show-request
4649 * Show which actions apply to a URL and why:
4651 http://config.privoxy.org/show-url-info
4653 * Toggle Privoxy on or off. In this case, "Privoxy" continues to run, but
4654 only as a pass-through proxy, with no actions taking place:
4656 http://config.privoxy.org/toggle
4658 Short cuts. Turn off, then on:
4660 http://config.privoxy.org/toggle?set=disable
4662 http://config.privoxy.org/toggle?set=enable
4664 These may be bookmarked for quick reference. See next.
4666 -------------------------------------------------------------------------------
4668 14.2.1. Bookmarklets
4670 Below are some "bookmarklets" to allow you to easily access a "mini" version of
4671 some of Privoxy's special pages. They are designed for MS Internet Explorer,
4672 but should work equally well in Netscape, Mozilla, and other browsers which
4673 support JavaScript. They are designed to run directly from your bookmarks - not
4674 by clicking the links below (although that should work for testing).
4676 To save them, right-click the link and choose "Add to Favorites" (IE) or "Add
4677 Bookmark" (Netscape). You will get a warning that the bookmark "may not be
4678 safe" - just click OK. Then you can run the Bookmarklet directly from your
4679 favorites/bookmarks. For even faster access, you can put them on the "Links"
4680 bar (IE) or the "Personal Toolbar" (Netscape), and run them with a single
4687 * Privoxy - Toggle Privoxy (Toggles between enabled and disabled)
4689 * Privoxy- View Status
4691 * Privoxy - Submit Actions File Feedback
4695 Credit: The site which gave us the general idea for these bookmarklets is
4696 www.bookmarklets.com. They have more information about bookmarklets.
4698 -------------------------------------------------------------------------------
4700 14.3. Chain of Events
4702 Let's take a quick look at the basic sequence of events when a web page is
4703 requested by your browser and Privoxy is on duty:
4705 * First, your web browser requests a web page. The browser knows to send the
4706 request to Privoxy, which will in turn, relay the request to the remote web
4707 server after passing the following tests:
4709 * Privoxy traps any request for its own internal CGI pages (e.g http://p.p/)
4710 and sends the CGI page back to the browser.
4712 * Next, Privoxy checks to see if the URL matches any "+block" patterns. If
4713 so, the URL is then blocked, and the remote web server will not be
4714 contacted. "+handle-as-image" is then checked and if it does not match, an
4715 HTML "BLOCKED" page is sent back. Otherwise, if it does match, an image is
4716 returned. The type of image depends on the setting of "+set-image-blocker"
4717 (blank, checkerboard pattern, or an HTTP redirect to an image elsewhere).
4719 * Untrusted URLs are blocked. If URLs are being added to the trust file, then
4722 * If the URL pattern matches the "+fast-redirects" action, it is then
4723 processed. Unwanted parts of the requested URL are stripped.
4725 * Now the rest of the client browser's request headers are processed. If any
4726 of these match any of the relevant actions (e.g. "+hide-user-agent", etc.),
4727 headers are suppressed or forged as determined by these actions and their
4730 * Now the web server starts sending its response back (i.e. typically a web
4731 page and related data).
4733 * First, the server headers are read and processed to determine, among other
4734 things, the MIME type (document type) and encoding. The headers are then
4735 filtered as determined by the "+crunch-incoming-cookies",
4736 "+session-cookies-only", and "+downgrade-http-version" actions.
4738 * If the "+kill-popups" action applies, and it is an HTML or JavaScript
4739 document, the popup-code in the response is filtered on-the-fly as it is
4742 * If a "+filter" or "+deanimate-gifs" action applies (and the document type
4743 fits the action), the rest of the page is read into memory (up to a
4744 configurable limit). Then the filter rules (from default.filter) are
4745 processed against the buffered content. Filters are applied in the order
4746 they are specified in the default.filter file. Animated GIFs, if present,
4747 are reduced to either the first or last frame, depending on the action
4748 setting.The entire page, which is now filtered, is then sent by Privoxy
4749 back to your browser.
4751 If neither "+filter" or "+deanimate-gifs" matches, then Privoxy passes the
4752 raw data through to the client browser as it becomes available.
4754 * As the browser receives the now (probably filtered) page content, it reads
4755 and then requests any URLs that may be embedded within the page source,
4756 e.g. ad images, stylesheets, JavaScript, other HTML documents (e.g.
4757 frames), sounds, etc. For each of these objects, the browser issues a new
4758 request. And each such request is in turn processed as above. Note that a
4759 complex web page may have many such embedded URLs.
4761 -------------------------------------------------------------------------------
4763 14.4. Anatomy of an Action
4765 The way Privoxy applies actions and filters to any given URL can be complex,
4766 and not always so easy to understand what is happening. And sometimes we need
4767 to be able to see just what Privoxy is doing. Especially, if something Privoxy
4768 is doing is causing us a problem inadvertently. It can be a little daunting to
4769 look at the actions and filters files themselves, since they tend to be filled
4770 with regular expressions whose consequences are not always so obvious.
4772 One quick test to see if Privoxy is causing a problem or not, is to disable it
4773 temporarily. This should be the first troubleshooting step. See the
4774 Bookmarklets section on a quick and easy way to do this (be sure to flush
4775 caches afterward!). Looking at the logs is a good idea too.
4777 Privoxy also provides the http://config.privoxy.org/show-url-info page that can
4778 show us very specifically how actions are being applied to any given URL. This
4779 is a big help for troubleshooting.
4781 First, enter one URL (or partial URL) at the prompt, and then Privoxy will tell
4782 us how the current configuration will handle it. This will not help with
4783 filtering effects (i.e. the "+filter" action) from the default.filter file
4784 since this is handled very differently and not so easy to trap! It also will
4785 not tell you about any other URLs that may be embedded within the URL you are
4786 testing. For instance, images such as ads are expressed as URLs within the raw
4787 page source of HTML pages. So you will only get info for the actual URL that is
4788 pasted into the prompt area -- not any sub-URLs. If you want to know about
4789 embedded URLs like ads, you will have to dig those out of the HTML source. Use
4790 your browser's "View Page Source" option for this. Or right click on the ad,
4793 Let's try an example, google.com, and look at it one section at a time:
4795 Matches for http://google.com:
4797 In file: default.action [ View ] [ Edit ]
4801 -crunch-outgoing-cookies
4802 -crunch-incoming-cookies
4803 +deanimate-gifs{last}
4804 -downgrade-http-version
4808 -filter{shockwave-flash}
4809 -filter{crude-parental}
4810 +filter{html-annoyances}
4811 +filter{js-annoyances}
4812 +filter{content-cookies}
4814 +filter{refresh-tags}
4816 +filter{banners-by-size}
4817 +hide-forwarded-for-headers
4818 +hide-from-header{block}
4819 +hide-referer{forge}
4824 +prevent-compression
4827 +session-cookies-only
4828 +set-image-blocker{pattern} }
4831 { -session-cookies-only }
4837 In file: user.action [ View ] [ Edit ]
4838 (no matches in this file)
4841 This tells us how we have defined our "actions", and which ones match for our
4842 example, "google.com". The first listing is any matches for the standard.action
4843 file. No hits at all here on "standard". Then next is "default", or our
4844 default.action file. The large, multi-line listing, is how the actions are set
4845 to match for all URLs, i.e. our default settings. If you look at your "actions"
4846 file, this would be the section just below the "aliases" section near the top.
4847 This will apply to all URLs as signified by the single forward slash at the end
4848 of the listing -- "/".
4850 But we can define additional actions that would be exceptions to these general
4851 rules, and then list specific URLs (or patterns) that these exceptions would
4852 apply to. Last match wins. Just below this then are two explicit matches for
4853 ".google.com". The first is negating our previous cookie setting, which was for
4854 "+session-cookies-only" (i.e. not persistent). So we will allow persistent
4855 cookies for google. The second turns off any "+fast-redirects" action, allowing
4856 this to take place unmolested. Note that there is a leading dot here --
4857 ".google.com". This will match any hosts and sub-domains, in the google.com
4858 domain also, such as "www.google.com". So, apparently, we have these two
4859 actions defined somewhere in the lower part of our default.action file, and
4860 "google.com" is referenced somewhere in these latter sections.
4862 Then, for our user.action file, we again have no hits.
4864 And finally we pull it all together in the bottom section and summarize how
4865 Privoxy is applying all its "actions" to "google.com":
4871 -crunch-outgoing-cookies
4872 -crunch-incoming-cookies
4873 +deanimate-gifs{last}
4874 -downgrade-http-version
4878 -filter{shockwave-flash}
4879 -filter{crude-parental}
4880 +filter{html-annoyances}
4881 +filter{js-annoyances}
4882 +filter{content-cookies}
4884 +filter{refresh-tags}
4886 +filter{banners-by-size}
4887 +hide-forwarded-for-headers
4888 +hide-from-header{block}
4889 +hide-referer{forge}
4894 +prevent-compression
4897 -session-cookies-only
4898 +set-image-blocker{pattern}
4901 Notice the only difference here to the previous listing, is to "fast-redirects"
4902 and "session-cookies-only".
4904 Now another example, "ad.doubleclick.net":
4906 { +block +handle-as-image }
4909 { +block +handle-as-image }
4912 { +block +handle-as-image }
4916 We'll just show the interesting part here, the explicit matches. It is matched
4917 three different times. Each as an "+block +handle-as-image", which is the
4918 expanded form of one of our aliases that had been defined as: "+imageblock". (
4919 "Aliases" are defined in the first section of the actions file and typically
4920 used to combine more than one action.)
4922 Any one of these would have done the trick and blocked this as an unwanted
4923 image. This is unnecessarily redundant since the last case effectively would
4924 also cover the first. No point in taking chances with these guys though ;-)
4925 Note that if you want an ad or obnoxious URL to be invisible, it should be
4926 defined as "ad.doubleclick.net" is done here -- as both a "+block" and an
4927 "+handle-as-image". The custom alias "+imageblock" just simplifies the process
4928 and make it more readable.
4930 One last example. Let's try "http://www.rhapsodyk.net/adsl/HOWTO/". This one is
4931 giving us problems. We are getting a blank page. Hmmm ...
4933 Matches for http://www.rhapsodyk.net/adsl/HOWTO/:
4935 In file: default.action [ View ] [ Edit ]
4939 -crunch-incoming-cookies
4940 -crunch-outgoing-cookies
4942 -downgrade-http-version
4944 +filter{html-annoyances}
4945 +filter{js-annoyances}
4946 +filter{kill-popups}
4949 +filter{banners-by-size}
4952 +hide-forwarded-for-headers
4953 +hide-from-header{block}
4954 +hide-referer{forge}
4958 +prevent-compression
4961 +session-cookies-only
4962 +set-image-blocker{blank} }
4965 { +block +handle-as-image }
4969 Ooops, the "/adsl/" is matching "/ads"! But we did not want this at all! Now we
4970 see why we get the blank page. We could now add a new action below this that
4971 explicitly does not block ("{-block}") paths with "adsl". There are various
4972 ways to handle such exceptions. Example:
4978 Now the page displays ;-) Be sure to flush your browser's caches when making
4979 such changes. Or, try using Shift+Reload.
4981 But now what about a situation where we get no explicit matches like we did
4984 { +block +handle-as-image }
4988 That actually was very telling and pointed us quickly to where the problem was.
4989 If you don't get this kind of match, then it means one of the default rules in
4990 the first section is causing the problem. This would require some guesswork,
4991 and maybe a little trial and error to isolate the offending rule. One likely
4992 cause would be one of the "{+filter}" actions. These tend to be harder to
4993 troubleshoot. Try adding the URL for the site to one of aliases that turn off
4998 .worldpay.com # for quietpc.com
5004 "{shop}" is an "alias" that expands to "{ -filter -session-cookies-only }". Or
5005 you could do your own exception to negate filtering:
5011 This would turn off all filtering for that site. This would probably be most
5012 appropriately put in user.action, for local site exceptions.
5014 Images that are inexplicably being blocked, may well be hitting the "+filter
5015 {banners-by-size}" rule, which assumes that images of certain sizes are ad
5016 banners (works well most of the time since these tend to be standardized).
5018 "{fragile}" is an alias that disables most actions. This can be used as a last
5019 resort for problem sites. Remember to flush caches! If this still does not
5020 work, you will have to go through the remaining actions one by one to find
5021 which one(s) is causing the problem.