5 $Id: user-manual.sgml,v 1.91 2002/04/24 02:39:31 hal9 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, filtering 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 -------------------------------------------------------------------------------
34 3.1.1. Red Hat and SuSE RPMs
37 3.1.4. Solaris, NetBSD, FreeBSD, HP-UX
42 3.2. Building from Source
44 4. Quickstart to Using Privoxy
46 4.1. Note to Upgraders
48 4.3. Command Line Options
50 5. Privoxy Configuration
52 5.1. Controlling Privoxy with Your Web Browser
53 5.2. Configuration Files Overview
54 5.3. The Main Configuration File
56 5.3.1. Configuration and Log File Locations
57 5.3.2. Local Set-up Documentation
59 5.3.4. Access Control and Security
61 5.3.6. Windows GUI Options
65 5.4.1. Finding the Right Mix
67 5.4.3. How Actions are Applied to URLs
75 6. Contacting the Developers, Bug Reporting and Feature Requests
77 6.1. Submitting Ads and "Action" Problems
79 7. Copyright and History
87 9.1. Regular Expressions
88 9.2. Privoxy's Internal Pages
93 9.4. Anatomy of an Action
95 -------------------------------------------------------------------------------
99 This documentation is included with the current beta version of Privoxy,
100 v.2.9.14, and is mostly complete at this point. The most up to date reference
101 for the time being is still the comments in the source files and in the
102 individual configuration files. Development of version 3.0 is currently nearing
103 completion, and includes many significant changes and enhancements over earlier
104 versions. The target release date for stable v3.0 is "soon" ;-).
106 Since this is a beta version, not all new features are well tested. This
107 documentation may be slightly out of sync as a result (especially with CVS
108 sources). And there may be bugs, though hopefully not many!
110 -------------------------------------------------------------------------------
114 In addition to Internet Junkbuster's traditional features of ad and banner
115 blocking and cookie management, Privoxy provides new features, some of them
116 currently under development:
118 * Integrated browser based configuration and control utility at http://
119 config.privoxy.org/ (shortcut: http://p.p/). Browser-based tracing of rule
120 and filter effects. Remote toggling.
122 * Blocking of annoying pop-up browser windows.
124 * HTTP/1.1 compliant (but not all optional 1.1 features are supported).
126 * Support for Perl Compatible Regular Expressions in the configuration files,
127 and generally a more sophisticated and flexible configuration syntax over
132 * Web page content filtering (removes banners based on size, invisible
133 "web-bugs", JavaScript and HTML annoyances, pop-ups, etc.)
135 * Bypass many click-tracking scripts (avoids script redirection).
137 * Multi-threaded (POSIX and native threads).
139 * Auto-detection and re-reading of config file changes.
141 * User-customizable HTML templates (e.g. 404 error page).
143 * Improved cookie management features (e.g. session based cookies).
145 * Improved signal handling, and a true daemon mode (Unix).
147 * Builds from source on most UNIX-like systems. Packages available for: Linux
148 (RedHat, SuSE, or Debian), Windows, Sun Solaris, Mac OSX, OS/2, HP-UX 11,
151 * Every feature now controllable on a per-site or per-location basis,
152 configuration more powerful and versatile over-all.
154 * Many smaller new features added, limitations and bugs removed, and security
157 -------------------------------------------------------------------------------
161 Privoxy is available both in convenient pre-compiled packages for a wide range
162 of operating systems, and as raw source code. For most users, we recommend
163 using the packages, which can be downloaded from our Privoxy Project Page.
165 If you like to live on the bleeding edge and are not afraid of using possibly
166 unstable development versions, you can check out the up-to-the-minute version
167 directly from the CVS repository or simply download the nightly CVS tarball.
169 At present, Privoxy is known to run on Win32, Mac OSX, OS/2, AmigaOS, Linux
170 (RedHat, Suse, Debian), FreeBSD, NetBSD, BeOS, and many flavors of Unix.
172 -------------------------------------------------------------------------------
176 Note: If you have a previous Junkbuster or Privoxy installation on your system,
177 you will need to remove it. Some platforms do this for you as part of their
178 installation procedure. (See below for your platform).
180 In any case be sure to backup your old configuration if it is valuable to you.
181 See the note to upgraders.
183 How to install the binary packages depends on your operating system:
185 -------------------------------------------------------------------------------
187 3.1.1. Red Hat and SuSE RPMs
189 RPMs can be installed with rpm -Uvh privoxy-2.9.14-1.rpm, and will use /etc/
190 privoxy for the location of configuration files.
192 Note that on Red Hat, Privoxy will not be automatically started on system boot.
193 You will need to enable that using chkconfig, ntsysv, or similar method.
195 If you have problems with failed dependencies, try rebuilding the SRC RPM: rpm
196 --rebuild privoxy-2.9.14-1.src.rpm;. This will use your locally installed
197 libraries and RPM version.
199 Also note that if you have a Junkbuster RPM installed on your system, you need
200 to remove it first, because the packages conflict. Otherwise, RPM will try to
201 remove Junkbuster automatically, before installing Privoxy.
203 -------------------------------------------------------------------------------
209 -------------------------------------------------------------------------------
213 Just double-click the installer, which will guide you through the installation
216 -------------------------------------------------------------------------------
218 3.1.4. Solaris, NetBSD, FreeBSD, HP-UX
220 Create a new directory, cd to it, then unzip and untar the archive. For the
221 most part, you'll have to figure out where things go. FIXME.
223 -------------------------------------------------------------------------------
227 First, make sure that no previous installations of Junkbuster and / or Privoxy
228 are left on your system. You can do this by
230 Then, just double-click the WarpIN self-installing archive, which will guide
231 you through the installation process. A shadow of the Privoxy executable will
232 be placed in your startup folder so it will start automatically whenever OS/2
235 The directory you choose to install Privoxy into will contain all of the
238 -------------------------------------------------------------------------------
242 Unzip the downloaded package (you can either double-click on the file in the
243 finder, or on the desktop if you downloaded it there). Then, double-click on
244 the package installer icon and follow the installation process. Privoxy will be
245 installed in the subdirectory /Applications/Privoxy.app. Privoxy will set
246 itself up to start automatically on system bringup via /System/Library/
247 StartupItems/Privoxy.
249 -------------------------------------------------------------------------------
253 Copy and then unpack the lha archive to a suitable location. All necessary
254 files will be installed into Privoxy directory, including all configuration and
255 log files. To uninstall, just remove this directory.
257 Start Privoxy (with RUN <>NIL:) in your startnet script (AmiTCP), in s:
258 user-startup (RoadShow), as startup program in your startup script (Genesis),
259 or as startup action (Miami and MiamiDx). Privoxy will automatically quit when
260 you quit your TCP/IP stack (just ignore the harmless warning your TCP/IP stack
261 may display that Privoxy is still running).
263 -------------------------------------------------------------------------------
265 3.2. Building from Source
267 To build Privoxy from source, autoheader, autoconf, GNU make (gmake), and, of
268 course, a C compiler are required.
270 When building from a source tarball (either release version or nightly CVS
271 tarball), first unpack the source:
273 tar xzvf privoxy-2.9.14-beta-src* [.tgz or .tar.gz]
274 cd privoxy-2.9.14-beta
277 For retrieving the current CVS sources, you'll need CVS installed. Note that
278 sources from CVS are development quality, and may not be stable, or well
279 tested. To download CVS source:
281 cvs -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa login
282 cvs -z3 -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa co current
286 This will create a directory named current/, which will contain the source
289 Then, in either case, to build from unpacked tarball or CVS source:
293 ./configure # (--help to see options)
294 make # (the make from gnu, gmake for *BSD)
296 make -n install # (to see where all the files will go)
297 make install # (to really install)
300 If you have gnu make, you can have the first four steps automatically done for
306 in the freshly downloaded or unpacked source directory.
308 For more detailed instructions on how to build Redhat and SuSE RPMs, Windows
309 self-extracting installers, building on platforms with special requirements
310 etc, please consult the developer manual.
312 -------------------------------------------------------------------------------
314 4. Quickstart to Using Privoxy
316 4.1. Note to Upgraders
318 There are very significant changes from older versions of Junkbuster to the
319 current Privoxy. Configuration is substantially changed. Junkbuster 2.0.x and
320 earlier configuration files will not migrate. The functionality of the old
321 blockfile, cookiefile and imagelist, are now combined into the "actions file"
322 (default.action for most installations).
324 A "filter file" (typically default.filter) is new as of Privoxy 2.9.x, and
325 provides some of the new sophistication (explained below). config is much the
328 If upgrading from a 2.0.x version, you will have to use the new config files,
329 and possibly adapt any personal rules from your older files. When porting
330 personal rules over from the old blockfile to the new actions file, please note
331 that even the pattern syntax has changed. If upgrading from 2.9.x development
332 versions, it is still recommended to use the new configuration files.
334 A quick list of things to be aware of before upgrading:
336 * The default listening port is now 8118 due to a conflict with another
339 * Some installers may remove earlier versions completely. Save any important
342 * Privoxy is controllable with a web browser at the special URL: http://
343 config.privoxy.org/ (Shortcut: http://p.p/). Many aspects of configuration
344 can be done here, including temporarily disabling Privoxy.
346 * The primary configuration file for cookie management, ad and banner
347 blocking, and many other aspects of Privoxy configuration is
348 default.action. It is strongly recommended to become familiar with the new
349 actions concept below, before modifying this file.
351 * Some installers may not automatically start Privoxy after installation.
353 -------------------------------------------------------------------------------
355 4.2. Starting Privoxy
357 Before launching Privoxy for the first time, you will want to configure your
358 browser(s) to use Privoxy as a HTTP and HTTPS proxy. The default is localhost
359 for the proxy address, and port 8118 (earlier versions used port 8000). This is
360 the one configuration step that must be done!
362 With Netscape (and Mozilla), this can be set under Edit -> Preferences ->
363 Advanced -> Proxies -> HTTP Proxy. For Internet Explorer: Tools -> Internet
364 Properties -> Connections -> LAN Setting. Then, check "Use Proxy" and fill in
365 the appropriate info (Address: localhost, Port: 8118). Include if HTTPS proxy
368 After doing this, flush your browser's disk and memory caches to force a
369 re-reading of all pages and to get rid of any ads that may be cached. You are
370 now ready to start enjoying the benefits of using Privoxy!
372 Privoxy is typically started by specifying the main configuration file to be
373 used on the command line. Example Unix startup command:
376 # /usr/sbin/privoxy /etc/privoxy/config
380 See below for other command line options.
382 An init script is provided for SuSE and Red Hat.
384 For for SuSE: rcprivoxy start
386 For Red Hat and Debian: /etc/rc.d/init.d/privoxy start
388 If no configuration file is specified on the command line, Privoxy will look
389 for a file named config in the current directory. Except on Win32 where it will
390 try config.txt. If no file is specified on the command line and no default
391 configuration file can be found, Privoxy will fail to start.
393 The included default configuration files should give a reasonable starting
394 point. Most of the per site configuration is done in the "actions" files. These
395 are where various cookie actions are defined, ad and banner blocking, and other
396 aspects of Privoxy configuration. There are several such files included, with
397 varying levels of aggressiveness.
399 You will probably want to keep an eye out for sites that require persistent
400 cookies, and add these to default.action as needed. By default, most of these
401 will be accepted only during the current browser session (aka "session
402 cookies"), until you add them to the configuration. If you want the browser to
403 handle this instead, you will need to edit default.action and disable this
404 feature. If you use more than one browser, it would make more sense to let
405 Privoxy handle this. In which case, the browser(s) should be set to accept all
408 Another feature where you will probably want to define exceptions for trusted
409 sites is the popup-killing (through the +popup and +filter{popups} actions),
410 because your favorite shopping, banking, or leisure site may need popups.
412 Privoxy is HTTP/1.1 compliant, but not all of the optional 1.1 features are as
413 yet supported. In the unlikely event that you experience inexplicable problems
414 with browsers that use HTTP/1.1 per default (like Mozilla or recent versions of
415 I.E.), you might try to force HTTP/1.0 compatibility. For Mozilla, look under
416 Edit -> Preferences -> Debug -> Networking. Alternatively, set the "+downgrade"
417 config option in default.action which will downgrade your browser's HTTP
418 requests from HTTP/1.1 to HTTP/1.0 before processing them.
420 After running Privoxy for a while, you can start to fine tune the configuration
421 to suit your personal, or site, preferences and requirements. There are many,
422 many aspects that can be customized. "Actions" (as specified in default.action)
423 can be adjusted by pointing your browser to http://config.privoxy.org/
424 (shortcut: http://p.p/), and then follow the link to "edit the actions list".
425 (This is an internal page and does not require Internet access.)
427 In fact, various aspects of Privoxy configuration can be viewed from this page,
428 including current configuration parameters, source code version numbers, the
429 browser's request headers, and "actions" that apply to a given URL. In addition
430 to the default.action file editor mentioned above, Privoxy can also be turned
431 "on" and "off" (toggled) from this page.
433 If you encounter problems, try loading the page without Privoxy. If that helps,
434 enter the URL where you have the problems into the browser based rule tracing
435 utility. See which rules apply and why, and then try turning them off for that
436 site one after the other, until the problem is gone. When you have found the
437 culprit, you might want to turn the rest on again.
439 If the above paragraph sounds gibberish to you, you might want to read more
440 about the actions concept or even dive deep into the Appendix on actions.
442 If you can't get rid of the problem at all, think you've found a bug in
443 Privoxy, want to propose a new feature or smarter rules, please see the chapter
444 "Contacting the Developers, .." below.
446 -------------------------------------------------------------------------------
448 4.3. Command Line Options
450 Privoxy may be invoked with the following command-line options:
454 Print version info and exit. Unix only.
458 Print short usage info and exit. Unix only.
462 Don't become a daemon, i.e. don't fork and become process group leader, and
463 don't detach from controlling tty. Unix only.
467 On startup, write the process ID to FILE. Delete the FILE on exit. Failure
468 to create or delete the FILE is non-fatal. If no FILE option is given, no
469 PID file will be used. Unix only.
471 * --user USER[.GROUP]
473 After (optionally) writing the PID file, assume the user ID of USER, and if
474 included the GID of GROUP. Exit if the privileges are not sufficient to do
479 If no configfile is included on the command line, Privoxy will look for a
480 file named "config" in the current directory (except on Win32 where it will
481 look for "config.txt" instead). Specify full path to avoid confusion. If no
482 config file is found, Privoxy will fail to start.
484 -------------------------------------------------------------------------------
486 5. Privoxy Configuration
488 All Privoxy configuration is stored in text files. These files can be edited
489 with a text editor. Many important aspects of Privoxy can also be controlled
490 easily with a web browser.
492 -------------------------------------------------------------------------------
494 5.1. Controlling Privoxy with Your Web Browser
496 Privoxy's user interface can be reached through the special URL http://
497 config.privoxy.org/ (shortcut: http://p.p/), which is a built-in page and works
498 without Internet access. You will see the following section:
500 Please choose from the following options:
503 * Show information about the current configuration
504 * Show the source code version numbers
505 * Show the request headers.
506 * Show which actions apply to a URL and why
507 * Toggle Privoxy on or off
508 * Edit the actions list
512 This should be self-explanatory. Note the last item is an editor for the
513 "actions list", which is where much of the ad, banner, cookie, and URL blocking
514 magic is configured as well as other advanced features of Privoxy. This is an
515 easy way to adjust various aspects of Privoxy configuration. The actions file,
516 and other configuration files, are explained in detail below.
518 "Toggle Privoxy On or Off" is handy for sites that might have problems with
519 your current actions and filters. You can in fact use it as a test to see
520 whether it is Privoxy causing the problem or not. Privoxy continues to run as a
521 proxy in this case, but all filtering is disabled. There is even a toggle
522 Bookmarklet offered, so that you can toggle Privoxy with one click from your
525 -------------------------------------------------------------------------------
527 5.2. Configuration Files Overview
529 For Unix, *BSD and Linux, all configuration files are located in /etc/privoxy/
530 by default. For MS Windows, OS/2, and AmigaOS these are all in the same
531 directory as the Privoxy executable. The name and number of configuration files
532 has changed from previous versions, and is subject to change as development
535 The installed defaults provide a reasonable starting point, though possibly
536 aggressive by some standards. For the time being, there are only three default
537 configuration files (this may change in time):
539 * The main configuration file is named config on Linux, Unix, BSD, OS/2, and
540 AmigaOS and config.txt on Windows.
542 * default.action (the actions file) is used to define which of a set of
543 various "actions" relating to images, banners, pop-ups, access
544 restrictions, banners and cookies are to be applied, and where. There is a
545 web based editor for this file that can be accessed at http://
546 config.privoxy.org/edit-actions/ (Shortcut: http://p.p/edit-actions/).
547 (Other actions files are included as well with differing levels of
548 filtering and blocking, e.g. basic.action.)
550 * default.filter (the filter file) can be used to re-write the raw page
551 content, including viewable text as well as embedded HTML and JavaScript,
552 and whatever else lurks on any given web page. The filtering jobs are only
553 pre-defined here; whether to apply them or not is up to the actions file.
555 All files use the "#" character to denote a comment (the rest of the line will
556 be ignored) and understand line continuation through placing a backslash ("\")
557 as the very last character in a line. If the # is preceded by a backslash, it
558 looses its special function. Placing a # in front of an otherwise valid
559 configuration line to prevent it from being interpreted is called "commenting
562 default.action and default.filter can use Perl style regular expressions for
565 After making any changes, there is no need to restart Privoxy in order for the
566 changes to take effect. Privoxy detects such changes automatically. Note,
567 however, that it may take one or two additional requests for the change to take
568 effect. When changing the listening address of Privoxy, these "wake up"
569 requests must obviously be sent to the old listening address.
571 While under development, the configuration content is subject to change. The
572 below documentation may not be accurate by the time you read this. Also, what
573 constitutes a "default" setting, may change, so please check all your
574 configuration files on important issues.
576 -------------------------------------------------------------------------------
578 5.3. The Main Configuration File
580 Again, the main configuration file is named config on Linux/Unix/BSD and OS/2,
581 and config.txt on Windows. Configuration lines consist of an initial keyword
582 followed by a list of values, all separated by whitespace (any number of spaces
583 or tabs). For example:
588 Assigns the value /etc/privoxy to the option confdir and thus indicates that
589 the configuration directory is named "/etc/privoxy/".
591 All options in the config file except for confdir and logdir are optional.
592 Watch out in the below description for what happens if you leave them unset.
594 The main config file controls all aspects of Privoxy's operation that are not
595 location dependent (i.e. they apply universally, no matter where you may be
598 -------------------------------------------------------------------------------
600 5.3.1. Configuration and Log File Locations
602 Privoxy can (and normally does) use a number of other files for additional
603 configuration and logging. This section of the configuration file tells Privoxy
604 where to find those other files.
606 -------------------------------------------------------------------------------
612 The directory where the other configuration files are located
620 /etc/privoxy (Unix) or Privoxy installation dir (Windows)
628 No trailing "/", please
630 When development goes modular and multi-user, the blocker, filter, and
631 per-user config will be stored in subdirectories of "confdir". For now, the
632 configuration directory structure is flat, except for confdir/templates,
633 where the HTML templates for CGI output reside (e.g. Privoxy's 404 error
636 -------------------------------------------------------------------------------
642 The directory where all logging takes place (i.e. where logfile and jarfile
651 /var/log/privoxy (Unix) or Privoxy installation dir (Windows)
659 No trailing "/", please
661 -------------------------------------------------------------------------------
667 The actions file to use
671 File name, relative to confdir
675 default.action (Unix) or default.action.txt (Windows)
679 No action is taken at all. Simple neutral proxying.
683 There is no point in using Privoxy without an actions file. There are three
684 different actions files included in the distribution, with varying degrees
685 of aggressiveness: default.action, intermediate.action and advanced.action.
687 -------------------------------------------------------------------------------
693 The filter file to use
697 File name, relative to confdir
701 default.filter (Unix) or default.filter.txt (Windows)
705 No textual content filtering takes place, i.e. all +filter{name} actions in
706 the actions file are turned off
710 The "default.filter" file contains content modification rules that use
711 "regular expressions". These rules permit powerful changes on the content
712 of Web pages, e.g., you could disable your favorite JavaScript annoyances,
713 re-write the actual displayed text, or just have some fun replacing
714 "Microsoft" with "MicroSuck" wherever it appears on a Web page.
716 -------------------------------------------------------------------------------
726 File name, relative to logdir
730 logfile (Unix) or privoxy.log (Windows)
734 No log file is used, all log messages go to the console (stderr).
738 The windows version will additionally log to the console.
740 The logfile is where all logging and error messages are written. The level
741 of detail and number of messages are set with the debug option (see below).
742 The logfile can be useful for tracking down a problem with Privoxy (e.g.,
743 it's not blocking an ad you think it should block) but in most cases you
744 probably will never look at it.
746 Your logfile will grow indefinitely, and you will probably want to
747 periodically remove it. On Unix systems, you can do this with a cron job
748 (see "man cron"). For Red Hat, a logrotate script has been included.
750 On SuSE Linux systems, you can place a line like "/var/log/privoxy.* +1024k
751 644 nobody.nogroup" in /etc/logfiles, with the effect that cron.daily will
752 automatically archive, gzip, and empty the log, when it exceeds 1M size.
754 -------------------------------------------------------------------------------
760 The file to store intercepted cookies in
764 File name, relative to logdir
768 jarfile (Unix) or privoxy.jar (Windows)
772 Intercepted cookies are not stored at all.
776 The jarfile may grow to ridiculous sizes over time.
778 -------------------------------------------------------------------------------
784 The trust file to use
788 File name, relative to confdir
792 Unset (commented out). When activated: trust (Unix) or trust.txt (Windows)
796 The whole trust mechanism is turned off.
800 The trust mechanism is an experimental feature for building white-lists and
801 should be used with care. It is NOT recommended for the casual user.
803 If you specify a trust file, Privoxy will only allow access to sites that
804 are named in the trustfile. You can also mark sites as trusted referrers
805 (with +), with the effect that access to untrusted sites will be granted,
806 if a link from a trusted referrer was used. The link target will then be
807 added to the "trustfile". Possible applications include limiting Internet
810 If you use + operator in the trust file, it may grow considerably over
813 -------------------------------------------------------------------------------
815 5.3.2. Local Set-up Documentation
817 If you intend to operate Privoxy for more users that just yourself, it might be
818 a good idea to let them know how to reach you, what you block and why you do
819 that, your policies etc.
821 -------------------------------------------------------------------------------
823 5.3.2.1. trust-info-url
827 A URL to be displayed in the error page that users will see if access to an
828 untrusted page is denied.
836 Two example URL are provided
840 No links are displayed on the "untrusted" error page.
844 The value of this option only matters if the experimental trust mechanism
845 has been activated. (See trustfile above.)
847 If you use the trust mechanism, it is a good idea to write up some on-line
848 documentation about your trust policy and to specify the URL(s) here. Use
849 multiple times for multiple URLs.
851 The URL(s) should be added to the trustfile as well, so users don't end up
852 locked out from the information on why they were locked out in the first
855 -------------------------------------------------------------------------------
857 5.3.2.2. admin-address
861 An email address to reach the proxy administrator.
873 No email address is displayed on error pages and the CGI user interface.
877 If both admin-address and proxy-info-url are unset, the whole "Local
878 Privoxy Support" box on all generated pages will not be shown.
880 -------------------------------------------------------------------------------
882 5.3.2.3. proxy-info-url
886 A URL to documentation about the local Privoxy setup, configuration or
899 No link to local documentation is displayed on error pages and the CGI user
904 If both admin-address and proxy-info-url are unset, the whole "Local
905 Privoxy Support" box on all generated pages will not be shown.
907 This URL shouldn't be blocked ;-)
909 -------------------------------------------------------------------------------
913 These options are mainly useful when tracing a problem. Note that you might
914 also want to invoke Privoxy with the --no-daemon command line option when
917 -------------------------------------------------------------------------------
923 Key values that determine what information gets logged.
931 12289 (i.e.: URLs plus informational and warning messages)
939 The available debug levels are:
941 debug 1 # show each GET/POST/CONNECT request
942 debug 2 # show each connection status
943 debug 4 # show I/O status
944 debug 8 # show header parsing
945 debug 16 # log all data into the logfile
946 debug 32 # debug force feature
947 debug 64 # debug regular expression filter
948 debug 128 # debug fast redirects
949 debug 256 # debug GIF de-animation
950 debug 512 # Common Log Format
951 debug 1024 # debug kill pop-ups
952 debug 4096 # Startup banner and warnings.
953 debug 8192 # Non-fatal errors
956 To select multiple debug levels, you can either add them or use multiple
959 A debug level of 1 is informative because it will show you each request as
960 it happens. 1, 4096 and 8192 are highly recommended so that you will notice
961 when things go wrong. The other levels are probably only of interest if you
962 are hunting down a specific problem. They can produce a hell of an output
965 The reporting of fatal errors (i.e. ones which crash Privoxy) is always on
966 and cannot be disabled.
968 If you want to use CLF (Common Log Format), you should set "debug 512" ONLY
969 and not enable anything else.
971 -------------------------------------------------------------------------------
973 5.3.3.2. single-threaded
977 Whether to run only one server thread
989 Multi-threaded (or, where unavailable: forked) operation, i.e. the ability
990 to serve multiple requests simultaneously.
994 This option is only there for debug purposes and you should never need to
995 use it. It will drastically reduce performance.
997 -------------------------------------------------------------------------------
999 5.3.4. Access Control and Security
1001 This section of the config file controls the security-relevant aspects of
1002 Privoxy's configuration.
1004 -------------------------------------------------------------------------------
1006 5.3.4.1. listen-address
1010 The IP address and TCP port on which Privoxy will listen for client
1023 Bind to localhost (127.0.0.1), port 8118. This is suitable and recommended
1024 for home users who run Privoxy on the same machine as their browser.
1028 You will need to configure your browser(s) to this proxy address and port.
1030 If you already have another service running on port 8118, or if you want to
1031 serve requests from other machines (e.g. on your local network) as well,
1032 you will need to override the default.
1034 If you leave out the IP address, Privoxy will bind to all interfaces
1035 (addresses) on your machine and may become reachable from the Internet. In
1036 that case, consider using access control lists (acl's) (see "ACLs" below),
1041 Suppose you are running Privoxy on a machine which has the address
1042 192.168.0.1 on your local private network (192.168.0.0) and has another
1043 outside connection with a different address. You want it to serve requests
1046 listen-address 192.168.0.1:8118
1049 -------------------------------------------------------------------------------
1055 Initial state of "toggle" status
1067 Act as if toggled on
1071 If set to 0, Privoxy will start in "toggled off" mode, i.e. behave like a
1072 normal, content-neutral proxy. See enable-remote-toggle below. This is not
1073 really useful anymore, since toggling is much easier via the web interface
1074 then via editing the conf file.
1076 The windows version will only display the toggle icon in the system tray if
1077 this option is present.
1079 -------------------------------------------------------------------------------
1081 5.3.4.3. enable-remote-toggle
1085 Whether or not the web-based toggle feature may be used
1097 The web-based toggle feature is disabled.
1101 When toggled off, Privoxy acts like a normal, content-neutral proxy, i.e.
1102 it acts as if none of the actions applied to any URL.
1104 For the time being, access to the toggle feature can not be controlled
1105 separately by "ACLs" or HTTP authentication, so that everybody who can
1106 access Privoxy (see "ACLs" and listen-address above) can toggle it for all
1107 users. So this option is not recommended for multi-user environments with
1110 Note that you must have compiled Privoxy with support for this feature,
1111 otherwise this option has no effect.
1113 -------------------------------------------------------------------------------
1115 5.3.4.4. enable-edit-actions
1119 Whether or not the web-based actions file editor may be used
1131 The web-based actions file editor is disabled.
1135 For the time being, access to the editor can not be controlled separately
1136 by "ACLs" or HTTP authentication, so that everybody who can access Privoxy
1137 (see "ACLs" and listen-address above) can modify its configuration for all
1138 users. So this option is not recommended for multi-user environments with
1141 Note that you must have compiled Privoxy with support for this feature,
1142 otherwise this option has no effect.
1144 -------------------------------------------------------------------------------
1146 5.3.4.5. ACLs: permit-access and deny-access
1150 Who can access what.
1154 src_addr[/src_masklen] [dst_addr[/dst_masklen]]
1156 Where src_addr and dst_addr are IP addresses in dotted decimal notation or
1157 valid DNS names, and src_masklen and dst_masklen are subnet masks in CIDR
1158 notation, i.e. integer values from 2 to 30 representing the length (in
1159 bits) of the network address. The masks and the whole destination part are
1168 Don't restrict access further than implied by listen-address
1172 Access controls are included at the request of ISPs and systems
1173 administrators, and are not usually needed by individual users. For a
1174 typical home user, it will normally suffice to ensure that Privoxy only
1175 listens on the localhost or internal (home) network address by means of the
1176 listen-address option.
1178 Please see the warnings in the FAQ that this proxy is not intended to be a
1179 substitute for a firewall or to encourage anyone to defer addressing basic
1180 security weaknesses.
1182 Multiple ACL lines are OK. If any ACLs are specified, then the Privoxy
1183 talks only to IP addresses that match at least one permit-access line and
1184 don't match any subsequent deny-access line. In other words, the last match
1185 wins, with the default being deny-access.
1187 If Privoxy is using a forwarder (see forward below) for a particular
1188 destination URL, the dst_addr that is examined is the address of the
1189 forwarder and NOT the address of the ultimate target. This is necessary
1190 because it may be impossible for the local Privoxy to determine the IP
1191 address of the ultimate target (that's often what gateways are used for).
1193 You should prefer using IP addresses over DNS names, because the address
1194 lookups take time. All DNS names must resolve! You can not use domain
1195 patterns like "*.org" or partial domain names. If a DNS name resolves to
1196 multiple IP addresses, only the first one is used.
1198 Denying access to particular sites by ACL may have undesired side effects
1199 if the site in question is hosted on a machine which also hosts other
1204 Explicitly define the default behavior if no ACL and listen-address are
1205 set: "localhost" is OK. The absence of a dst_addr implies that all
1206 destination addresses are OK:
1208 permit-access localhost
1211 Allow any host on the same class C subnet as www.privoxy.org access to
1212 nothing but www.example.com:
1214 permit-access www.privoxy.org/24 www.example.com/32
1217 Allow access from any host on the 26-bit subnet 192.168.45.64 to anywhere,
1218 with the exception that 192.168.45.73 may not access
1219 www.dirty-stuff.example.com:
1221 permit-access 192.168.45.64/26
1222 deny-access 192.168.45.73 www.dirty-stuff.example.com
1225 -------------------------------------------------------------------------------
1227 5.3.4.6. buffer-limit
1231 Maximum size of the buffer for content filtering.
1243 Use a 4MB (4096 KB) limit.
1247 For content filtering, i.e. the +filter and +deanimate-gif actions, it is
1248 necessary that Privoxy buffers the entire document body. This can be
1249 potentially dangerous, since a server could just keep sending data
1250 indefinitely and wait for your RAM to exhaust -- with nasty consequences.
1253 When a document buffer size reaches the buffer-limit, it is flushed to the
1254 client unfiltered and no further attempt to filter the rest of the document
1255 is made. Remember that there may be multiple threads running, which might
1256 require up to buffer-limit Kbytes each, unless you have enabled
1257 "single-threaded" above.
1259 -------------------------------------------------------------------------------
1263 This feature allows routing of HTTP requests through a chain of multiple
1264 proxies. It can be used to better protect privacy and confidentiality when
1265 accessing specific domains by routing requests to those domains through an
1266 anonymous public proxy (see e.g. http://www.multiproxy.org/anon_list.htm) Or to
1267 use a caching proxy to speed up browsing. Or chaining to a parent proxy may be
1268 necessary because the machine that Privoxy runs on has no direct Internet
1271 Also specified here are SOCKS proxies. Privoxy supports the SOCKS 4 and SOCKS
1274 -------------------------------------------------------------------------------
1280 To which parent HTTP proxy specific requests should be routed.
1284 target_domain[:port] http_parent[/port]
1286 Where target_domain is a domain name pattern (see the chapter on domain
1287 matching in the actions file), http_parent is the address of the parent
1288 HTTP proxy as an IP addresses in dotted decimal notation or as a valid DNS
1289 name (or "." to denote "no forwarding", and the optional port parameters
1290 are TCP ports, i.e. integer values from 1 to 64535
1298 Don't use parent HTTP proxies.
1302 If http_parent is ".", then requests are not forwarded to another HTTP
1303 proxy but are made directly to the web servers.
1305 Multiple lines are OK, they are checked in sequence, and the last match
1310 Everything goes to an example anonymizing proxy, except SSL on port 443
1311 (which it doesn't handle):
1313 forward .* anon-proxy.example.org:8080
1317 Everything goes to our example ISP's caching proxy, except for requests to
1320 forward .*. caching-proxy.example-isp.net:8000
1321 forward .example-isp.net .
1324 -------------------------------------------------------------------------------
1326 5.3.5.2. forward-socks4 and forward-socks4a
1330 Through which SOCKS proxy (and to which parent HTTP proxy) specific
1331 requests should be routed.
1335 target_domain[:port] socks_proxy[/port] http_parent[/port]
1337 Where target_domain is a domain name pattern (see the chapter on domain
1338 matching in the actions file), http_parent and socks_proxy are IP addresses
1339 in dotted decimal notation or valid DNS names (http_parent may be "." to
1340 denote "no HTTP forwarding"), and the optional port parameters are TCP
1341 ports, i.e. integer values from 1 to 64535
1349 Don't use SOCKS proxies.
1353 Multiple lines are OK, they are checked in sequence, and the last match
1356 The difference between forward-socks4 and forward-socks4a is that in the
1357 SOCKS 4A protocol, the DNS resolution of the target hostname happens on the
1358 SOCKS server, while in SOCKS 4 it happens locally.
1360 If http_parent is ".", then requests are not forwarded to another HTTP
1361 proxy but are made (HTTP-wise) directly to the web servers, albeit through
1366 From the company example.com, direct connections are made to all "internal"
1367 domains, but everything outbound goes through their ISP's proxy by way of
1368 example.com's corporate SOCKS 4A gateway to the Internet.
1370 forward-socks4a .*. socks-gw.example.com:1080 www-cache.example-isp.net:8080
1371 forward .example.com .
1374 A rule that uses a SOCKS 4 gateway for all destinations but no HTTP parent
1377 forward-socks4 .*. socks-gw.example.com:1080 .
1380 -------------------------------------------------------------------------------
1382 5.3.5.3. Advanced Forwarding Examples
1384 If you have links to multiple ISPs that provide various special content only to
1385 their subscribers, you can configure multiple Privoxies which have connections
1386 to the respective ISPs to act as forwarders to each other, so that your users
1387 can see the internal content of all ISPs.
1389 Assume that host-a has a PPP connection to isp-a.net. And host-b has a PPP
1390 connection to isp-b.net. Both run Privoxy. Their forwarding configuration can
1396 forward .isp-b.net host-b:8118
1402 forward .isp-a.net host-a:8118
1405 Now, your users can set their browser's proxy to use either host-a or host-b
1406 and be able to browse the internal content of both isp-a and isp-b.
1408 If you intend to chain Privoxy and squid locally, then chain as browser ->
1409 squid -> privoxy is the recommended way.
1411 Assuming that Privoxy and squid run on the same box, your squid configuration
1412 could then look like this:
1414 # Define Privoxy as parent proxy (without ICP)
1415 cache_peer 127.0.0.1 parent 8118 7 no-query
1417 # Define ACL for protocol FTP
1420 # Do not forward FTP requests to Privoxy
1421 always_direct allow ftp
1423 # Forward all the rest to Privoxy
1424 never_direct allow all
1427 You would then need to change your browser's proxy settings to squid's address
1428 and port. Squid normally uses port 3128. If unsure consult http_port in
1431 -------------------------------------------------------------------------------
1433 5.3.6. Windows GUI Options
1435 Privoxy has a number of options specific to the Windows GUI interface:
1437 If "activity-animation" is set to 1, the Privoxy icon will animate when
1438 "Privoxy" is active. To turn off, set to 0.
1440 activity-animation 1
1443 If "log-messages" is set to 1, Privoxy will log messages to the console window:
1448 If "log-buffer-size" is set to 1, the size of the log buffer, i.e. the amount
1449 of memory used for the log messages displayed in the console window, will be
1450 limited to "log-max-lines" (see below).
1452 Warning: Setting this to 0 will result in the buffer to grow infinitely and eat
1458 log-max-lines is the maximum number of lines held in the log buffer. See above.
1463 If "log-highlight-messages" is set to 1, Privoxy will highlight portions of the
1464 log messages with a bold-faced font:
1466 log-highlight-messages 1
1469 The font used in the console window:
1471 log-font-name Comic Sans MS
1474 Font size used in the console window:
1479 "show-on-task-bar" controls whether or not Privoxy will appear as a button on
1480 the Task bar when minimized:
1485 If "close-button-minimizes" is set to 1, the Windows close button will minimize
1486 Privoxy instead of closing the program (close with the exit option on the File
1489 close-button-minimizes 1
1492 The "hide-console" option is specific to the MS-Win console version of Privoxy.
1493 If this option is used, Privoxy will disconnect from and hide the command
1499 -------------------------------------------------------------------------------
1501 5.4. The Actions File
1503 The actions file (default.action, formerly: actionsfile or ijb.action) is used
1504 to define what actions Privoxy takes for which URLs, and thus determines how ad
1505 images, cookies and various other aspects of HTTP content and transactions are
1506 handled on which sites (or even parts thereof).
1508 Anything you want can blocked, including ads, banners, or just some obnoxious
1509 URL that you would rather not see. Cookies can be accepted or rejected, or
1510 accepted only during the current browser session (i.e. not written to disk),
1511 content can be modified, JavaScripts tamed, user-tracking fooled, and much
1512 more. See below for a complete list of available actions.
1514 An actions file typically has sections. At the top, "aliases" are defined
1515 (discussed below), then the default set of rules which will apply universally
1516 to all sites and pages. And then below that is generally a lengthy set of
1517 exceptions to the defined universal policies.
1519 -------------------------------------------------------------------------------
1521 5.4.1. Finding the Right Mix
1523 Note that some actions like cookie suppression or script disabling may render
1524 some sites unusable, which rely on these techniques to work properly. Finding
1525 the right mix of actions is not easy and certainly a matter of personal taste.
1526 In general, it can be said that the more "aggressive" your default settings (in
1527 the top section of the actions file) are, the more exceptions for "trusted"
1528 sites you will have to make later. If, for example, you want to kill popup
1529 windows per default, you'll have to make exceptions from that rule for sites
1530 that you regularly use and that require popups for actually useful content,
1531 like maybe your bank, favorite shop, or newspaper.
1533 We have tried to provide you with reasonable rules to start from in the
1534 distribution actions file. But there is no general rule of thumb on these
1535 things. There just are too many variables, and sites are constantly changing.
1536 Sooner or later you will want to change the rules (and read this chapter).
1538 -------------------------------------------------------------------------------
1542 The easiest way to edit the "actions" file is with a browser by using our
1543 browser-based editor, which is available at http://config.privoxy.org/
1546 If you prefer plain text editing to GUIs, you can of course also directly edit
1547 the default.action file.
1549 -------------------------------------------------------------------------------
1551 5.4.3. How Actions are Applied to URLs
1553 The actions file is divided into sections. There are special sections, like the
1554 "alias" sections which will be discussed later. For now let's concentrate on
1555 regular sections: They have a heading line (often split up to multiple lines
1556 for readability) which consist of a list of actions, separated by whitespace
1557 and enclosed in curly braces. Below that, there is a list of URL patterns, each
1560 To determine which actions apply to a request, the URL of the request is
1561 compared to all patterns in this file. Every time it matches, the list of
1562 applicable actions for the URL is incrementally updated, using the heading of
1563 the section in which the pattern is located. If multiple matches for the same
1564 URL set the same action differently, the last match wins.
1566 You can trace this process by visiting http://config.privoxy.org/show-url-info.
1568 More detail on this is provided in the Appendix, Anatomy of an Action.
1570 -------------------------------------------------------------------------------
1574 Generally, a pattern has the form <domain>/<path>, where both the <domain> and
1575 <path> are optional. (This is why the pattern / matches all URLs).
1579 is a domain-only pattern and will match any request to www.example.com,
1580 regardless of which document on that server is requested.
1584 means exactly the same. For domain-only patterns, the trailing / may be
1587 www.example.com/index.html
1589 matches only the single document /index.html on www.example.com.
1593 matches the document /index.html, regardless of the domain, i.e. on any web
1598 matches nothing, since it would be interpreted as a domain name and there
1599 is no top-level domain called .html.
1601 -------------------------------------------------------------------------------
1603 5.4.4.1. The Domain Pattern
1605 The matching of the domain part offers some flexible options: if the domain
1606 starts or ends with a dot, it becomes unanchored at that end. For example:
1610 matches any domain that ENDS in .example.com
1614 matches any domain that STARTS with www.
1618 matches any domain that CONTAINS .example. (Correctly speaking: It matches
1619 any FQDN that contains example as a domain.)
1621 Additionally, there are wild-cards that you can use in the domain names
1622 themselves. They work pretty similar to shell wild-cards: "*" stands for zero
1623 or more arbitrary characters, "?" stands for any single character, you can
1624 define character classes in square brackets and all of that can be freely
1629 matches "adserver.example.com", "ads.example.com", etc but not
1634 matches all of the above, and then some.
1638 matches www.ipix.com, pictures.epix.com, a.b.c.d.e.upix.com etc.
1640 www[1-9a-ez].example.c*
1642 matches www1.example.com, www4.example.cc, wwwd.example.cy,
1643 wwwz.example.com etc., but not wwww.example.com.
1645 -------------------------------------------------------------------------------
1647 5.4.4.2. The Path Pattern
1649 Privoxy uses Perl compatible regular expressions (through the PCRE library) for
1652 There is an Appendix with a brief quick-start into regular expressions, and
1653 full (very technical) documentation on PCRE regex syntax is available on-line
1654 at http://www.pcre.org/man.txt. You might also find the Perl man page on
1655 regular expressions (man perlre) useful, which is available on-line at http://
1656 www.perldoc.com/perl5.6/pod/perlre.html.
1658 Note that the path pattern is automatically left-anchored at the "/", i.e. it
1659 matches as if it would start with a "^".
1661 Please also note that matching in the path is case INSENSITIVE by default, but
1662 you can switch to case sensitive at any point in the pattern by using the "(?
1663 -i)" switch: www.example.com/(?-i)PaTtErN.* will match only documents whose
1664 path starts with PaTtErN in exactly this capitalization.
1666 -------------------------------------------------------------------------------
1670 Actions are enabled if preceded with a "+", and disabled if preceded with a
1671 "-". So a "+action" means "do that action", e.g. "+block" means please "block
1672 the following URLs and/or patterns". All actions are disabled by default, until
1673 they are explicitly enabled somewhere in an actions file.
1675 Actions are invoked by enclosing the action name in curly braces (e.g.
1676 {+some_action}), followed by a list of URLs (or patterns that match URLs) to
1677 which the action applies. There are three classes of actions:
1679 * Boolean, i.e the action can only be "on" or "off". Examples:
1681 {+name} # enable this action
1682 {-name} # disable this action
1685 * Parameterized, e.g. "+/-hide-user-agent{ Mozilla 1.0 }", where some value
1686 is required in order to enable this type of action. Examples:
1688 {+name{param}} # enable action and set parameter to "param"
1689 {-name} # disable action ("parameter") can be omitted
1692 * Multi-value, e.g. "{+/-add-header{Name: value}}" ot "{+/-wafer{name=value}}
1693 "), where some value needs to be defined in addition to simply enabling the
1696 {+name{param=value}} # enable action and set "param" to "value"
1697 {-name{param=value}} # remove the parameter "param" completely
1698 {-name} # disable this action totally and remove param too
1701 If nothing is specified in this file, no "actions" are taken. So in this case
1702 Privoxy would just be a normal, non-blocking, non-anonymizing proxy. You must
1703 specifically enable the privacy and blocking features you need (although the
1704 provided default default.action file will give a good starting point).
1706 Later defined actions always over-ride earlier ones. So exceptions to any rules
1707 you make, should come in the latter part of the file. For multi-valued actions,
1708 the actions are applied in the order they are specified.
1710 The list of valid Privoxy "actions" are:
1712 -------------------------------------------------------------------------------
1714 5.4.5.1. +add-header{Name: value}
1722 Send a user defined HTTP header to the web server.
1726 Any value is possible. Validity of the defined HTTP headers is not checked.
1730 {+add-header{X-User-Tracking: sucks}}
1736 This action may be specified multiple times, in order to define multiple
1737 headers. This is rarely needed for the typical user. If you don't know what
1738 "HTTP headers" are, you definitely don't need to worry about this one.
1740 -------------------------------------------------------------------------------
1750 Used to block a URL from reaching your browser. The URL may be anything,
1751 but is typically used to block ads or other obnoxious content.
1766 Privoxy will display its special "BLOCKED" page if a URL matches one of the
1767 blocked patterns. If there is sufficient space, a large red banner will
1768 appear with a friendly message about why the page was blocked, and a way to
1769 go there anyway. If there is insufficient space a smaller blocked page will
1770 appear without the red banner. One exception is if the URL matches both
1771 "+block" and "+image", then it can be handled by "+image-blocker" (see
1774 The "+filter" action can also perform some of the same functionality as
1775 "+block", but by virtue of very different programming techniques, and is
1776 typically used for different reasons.
1778 -------------------------------------------------------------------------------
1780 5.4.5.3. +deanimate-gifs
1788 To stop those annoying, distracting animated GIF images.
1796 {+deanimate-gifs{last}}
1802 De-animate all animated GIF images, i.e. reduce them to their last frame.
1803 This will also shrink the images considerably (in bytes, not pixels!). If
1804 the option "first" is given, the first frame of the animation is used as
1805 the replacement. If "last" is given, the last frame of the animation is
1806 used instead, which probably makes more sense for most banner animations,
1807 but also has the risk of not showing the entire last frame (if it is only a
1808 delta to an earlier frame).
1810 -------------------------------------------------------------------------------
1820 "+downgrade" will downgrade HTTP/1.1 client requests to HTTP/1.0 and
1821 downgrade the responses as well.
1835 Use this action for servers that use HTTP/1.1 protocol features that
1836 Privoxy doesn't handle well yet. HTTP/1.1 is only partially implemented.
1837 Default is not to downgrade requests. This is an infrequently needed
1838 action, and is used to help with problem sites only.
1840 -------------------------------------------------------------------------------
1842 5.4.5.5. +fast-redirects
1850 The "+fast-redirects" action enables interception of "redirect" requests
1851 from one server to another, which are used to track users.Privoxy can cut
1852 off all but the last valid URL in redirect request and send a local
1853 redirect back to your browser without contacting the intermediate site(s).
1867 Many sites, like yahoo.com, don't just link to other sites. Instead, they
1868 will link to some script on their own server, giving the destination as a
1869 parameter, which will then redirect you to the final target. URLs resulting
1870 from this scheme typically look like: http://some.place/some_script?http://
1873 Sometimes, there are even multiple consecutive redirects encoded in the
1874 URL. These redirections via scripts make your web browsing more traceable,
1875 since the server from which you follow such a link can see where you go to.
1876 Apart from that, valuable bandwidth and time is wasted, while your browser
1877 ask the server for one redirect after the other. Plus, it feeds the
1880 This is a normally on feature, and often requires exceptions for sites that
1881 are sensitive to defeating this mechanism.
1883 -------------------------------------------------------------------------------
1893 Apply page filtering as defined by named sections of the default.filter
1894 file to the specified site(s). "Filtering" can be any modification of the
1895 raw page content, including re-writing or deletion of content.
1899 "+filter" must include the name of one of the section identifiers from
1900 default.filter (or whatever filterfile is specified in config).
1902 Example usage (from the current default.filter):
1904 +filter{html-annoyances}: Get rid of particularly annoying HTML abuse.
1906 +filter{js-annoyances}: Get rid of particularly annoying JavaScript abuse
1908 +filter{content-cookies}: Kill cookies that come in the HTML or JS content
1910 +filter{popups}: Kill all popups in JS and HTML
1912 +filter{frameset-borders}: Give frames a border and make them resizable
1914 +filter{webbugs}: Squish WebBugs (1x1 invisible GIFs used for user
1917 +filter{refresh-tags}: Kill automatic refresh tags (for dial-on-demand
1920 +filter{fun}: Text replacements for subversive browsing fun!
1922 +filter{nimda}: Remove Nimda (virus) code.
1924 +filter{banners-by-size}: Kill banners by size (very efficient!)
1926 +filter{shockwave-flash}: Kill embedded Shockwave Flash objects
1928 +filter{crude-parental}: Kill all web pages that contain the words "sex" or
1933 This is potentially a very powerful feature! And requires a knowledge of
1934 regular expressions if you want to "roll your own". Filtering operates on a
1937 Filtering requires buffering the page content, which may appear to slow
1938 down page rendering since nothing is displayed until all content has passed
1939 the filters. (It does not really take longer, but seems that way since the
1940 page is not incrementally displayed.) This effect will be more noticeable
1941 on slower connections.
1943 Filtering can achieve some of the effects as the "+block" action, i.e. it
1944 can be used to block ads and banners. In the overall scheme of things,
1945 filtering is one of the last things "Privoxy" does with a web page. So
1946 other actions are applied first.
1948 -------------------------------------------------------------------------------
1950 5.4.5.7. +hide-forwarded
1958 Block any existing X-Forwarded-for HTTP header, and do not add a new one.
1972 It is fairly safe to leave this on. It does not seem to break many sites.
1974 -------------------------------------------------------------------------------
1984 To block the browser from sending your email address in a "From:" header.
1988 Keyword: "block", or any user defined value.
1998 The keyword "block" will completely remove the header. Alternately, you can
1999 specify any value you prefer to send to the web server.
2001 -------------------------------------------------------------------------------
2003 5.4.5.9. +hide-referer
2011 Don't send the "Referer:" (sic) HTTP header to the web site. Or,
2012 alternately send a forged header instead.
2016 Prevent the header from being sent with the keyword, "block". Or, "forge" a
2017 URL to one from the same server as the request. Or, set to user defined
2018 value of your choice.
2022 {+hide-referer{forge}}
2028 "forge" is the preferred option here, since some servers will not send
2029 images back otherwise.
2031 "+hide-referrer" is an alternate spelling of "+hide-referer". It has the
2032 exact same parameters, and can be freely mixed with, "+hide-referer".
2033 ("referrer" is the correct English spelling, however the HTTP specification
2034 has a bug - it requires it to be spelled as "referer".)
2036 -------------------------------------------------------------------------------
2038 5.4.5.10. +hide-user-agent
2046 To change the "User-Agent:" header so web servers can't tell your browser
2047 type. Who's business is it anyway?
2051 Any user defined string.
2055 {+hide-user-agent{Netscape 6.1 (X11; I; Linux 2.4.18 i686)}}
2061 Warning! This breaks many web sites that depend on this in order to
2062 determine how the target browser will respond to various requests. Use with
2065 -------------------------------------------------------------------------------
2075 To define what Privoxy should treat automatically as an image.
2084 /.*\.(gif|jpg|jpeg|png|bmp|ico)
2089 This only has meaning if the URL (or pattern) also is "+block"ed, in which
2090 case a "blocked" image can be sent rather than a HTML page. (See
2091 "+image-blocker{}" below for the control over what is actually sent.)
2093 There is little reason to change the default definition for this.
2095 -------------------------------------------------------------------------------
2097 5.4.5.12. +image-blocker
2105 Decide what to do with URLs that end up tagged with both "{+block}" and "
2106 {+image}", e.g an advertisement.
2110 There are four available options: "-image-blocker" will send a HTML
2111 "blocked" page, usually resulting in a "broken image" icon. "+image-blocker
2112 {blank}" will send a 1x1 transparent GIF image. "+image-blocker{pattern}"
2113 will send a checkerboard type pattern (the default). And finally,
2114 "+image-blocker{http://xyz.com}" will send a HTTP temporary redirect to the
2115 specified image. This has the advantage of the icon being being cached by
2116 the browser, which will speed up the display.
2120 {+image-blocker{blank}}
2126 If you want invisible ads, they need to be both defined as images and
2127 blocked. And then, "image-blocker" should be set to "blank" for
2128 invisibility. Note you cannot treat HTML pages as images in most cases. For
2129 instance, frames require an HTML page to display. So a frame that is an ad,
2130 cannot be treated as an image. Forcing an "image" in this situation just
2133 -------------------------------------------------------------------------------
2135 5.4.5.13. +limit-connect
2143 By default, Privoxy only allows HTTP CONNECT requests to port 443 (the
2144 standard, secure HTTPS port). Use "+limit-connect" to disable this
2145 altogether, or to allow more ports.
2149 Any valid port number, or port number range.
2153 +limit-connect{443} #
2154 This is the default and need not be specified.
2155 +limit-connect{80,443} # Ports 80 and 443 are OK.
2156 +limit-connect{-3, 7, 20-100, 500-} #
2157 Port less than 3, 7, 20 to 100 and above 500 are OK.
2162 The CONNECT methods exists in HTTP to allow access to secure websites
2163 (https:// URLs) through proxies. It works very simply: the proxy connects
2164 to the server on the specified port, and then short-circuits its
2165 connections to the client and to the remote proxy. This can be a big
2166 security hole, since CONNECT-enabled proxies can be abused as TCP relays
2169 If you want to allow CONNECT for more ports than this, or want to forbid
2170 CONNECT altogether, you can specify a comma separated list of ports and
2171 port ranges (the latter using dashes, with the minimum defaulting to 0 and
2174 If you don't know what any of this means, there probably is no reason to
2177 -------------------------------------------------------------------------------
2179 5.4.5.14. +no-compression
2187 Prevent the specified websites from compressing HTTP data.
2201 Some websites do this, which can be a problem for Privoxy, since "+filter",
2202 "+no-popup" and "+gif-deanimate" will not work on compressed data. This
2203 will slow down connections to those websites, though. Default typically is
2204 to turn "no-compression" on.
2206 -------------------------------------------------------------------------------
2208 5.4.5.15. +no-cookies-keep
2216 Allow cookies for the current browser session only.
2230 If websites set cookies, "no-cookies-keep" will make sure they are erased
2231 when you exit and restart your web browser. This makes profiling cookies
2232 useless, but won't break sites which require cookies so that you can log in
2233 for transactions. This is generally turned on for all sites. Sometimes
2234 referred to as "session cookies".
2236 -------------------------------------------------------------------------------
2238 5.4.5.16. +no-cookies-read
2246 Explicitly prevent the web server from reading any cookies on your system.
2260 Often used in conjunction with "+no-cookies-set" to disable persistant
2263 -------------------------------------------------------------------------------
2265 5.4.5.17. +no-cookies-set
2273 Explicitly block the web server from sending cookies to your system.
2287 Often used in conjunction with "+no-cookies-read" to disable persistant
2290 -------------------------------------------------------------------------------
2300 Stop those annoying JavaScript pop-up windows!
2314 "+no-popup" uses a built in filter to disable pop-ups that use the
2315 window.open() function, etc.
2317 An alternate spelling is "+no-popups", which is interchangeable.
2319 -------------------------------------------------------------------------------
2321 5.4.5.19. +vanilla-wafer
2329 Sends a cookie for every site stating that you do not accept any copyright
2330 on cookies sent to you, and asking them not to track you.
2344 This action only applies if you are using a jarfile for saving cookies. Of
2345 course, this is a (relatively) unique header and could be used to track
2348 -------------------------------------------------------------------------------
2358 This allows you to send an arbitrary, user definable cookie.
2362 User specified cookie name and corresponding value.
2366 {+wafer{name=value}}
2372 This can be specified multiple times in order to add as many cookies as you
2375 -------------------------------------------------------------------------------
2377 5.4.5.21. Actions Examples
2379 Note that the meaning of any of the above examples is reversed by preceding the
2380 action with a "-", in place of the "+". Also, that some actions are turned on
2381 in the default section of the actions file, and require little to no additional
2382 configuration. These are just "on". Some actions that are turned on the default
2383 section do typically require exceptions to be listed in the lower sections of
2388 Turn off cookies by default, then allow a few through for specified sites:
2390 # Turn off all persistent cookies
2391 { +no-cookies-read }
2394 # Allow cookies for this browser session ONLY
2395 { +no-cookies-keep }
2397 # Exceptions to the above, sites that benefit from persistent cookies
2398 # that saved from one browser session to the next.
2399 { -no-cookies-read }
2401 { -no-cookies-keep }
2408 # Alternative way of saying the same thing
2409 {-no-cookies-set -no-cookies-read -no-cookies-keep}
2414 Now turn off "fast redirects", and then we allow two exceptions:
2419 # Reverse it for these two sites, which don't work right without it.
2421 www.ukc.ac.uk/cgi-bin/wac\.cgi\?
2425 Turn on page filtering according to rules in the defined sections of
2426 default.filter, and make one exception for Sourceforge:
2428 # Run everything through the filter file, using only the
2429 # specified sections:
2430 +filter{html-annoyances} +filter{js-annoyances} +filter{no-popups}\
2431 +filter{webbugs} +filter{nimda} +filter{banners-by-size}
2433 # Then disable filtering of code from sourceforge!
2435 .cvs.sourceforge.net
2438 Now some URLs that we want "blocked" (normally generates the "blocked" banner).
2439 Many of these use regular expressions that will expand to match multiple URLs:
2443 /.*/(.*[-_.])?ads?[0-9]?(/|[-_.].*|\.(gif|jpe?g))
2444 /.*/(.*[-_.])?count(er)?(\.cgi|\.dll|\.exe|[?/])
2445 /.*/(ng)?adclient\.cgi
2446 /.*/(plain|live|rotate)[-_.]?ads?/
2447 /.*/(sponsor)s?[0-9]?/
2448 /.*/_?(plain|live)?ads?(-banners)?/
2450 /.*/ad(sdna_image|gifs?)/
2451 /.*/ad(server|stream|juggler)\.(cgi|pl|dll|exe)
2455 /.*/adv((er)?ts?|ertis(ing|ements?))?/
2459 /.*/cgi-bin/centralad/getimage
2460 /.*/images/addver\.gif
2461 /.*/images/marketing/.*\.(gif|jpe?g)
2465 /.*/sponsors?[0-9]?/
2466 /.*/advert[0-9]+\.jpg
2473 /graphics/defaultAd/
2475 /image\.ng/transactionID
2476 /images/.*/.*_anim\.gif # alvin brattli
2477 /ip_img/.*\.(gif|jpe?g)
2481 /cgi-bin/nph-adclick.exe/
2482 /.*/Image/BannerAdvertising/
2484 /.*/adlib/server\.cgi
2488 Note that many of these actions have the potential to cause a page to
2489 misbehave, possibly even not to display at all. There are many ways a site
2490 designer may choose to design his site, and what HTTP header content he may
2491 depend on. There is no way to have hard and fast rules for all sites. See the
2492 Appendix for a brief example on troubleshooting actions.
2494 -------------------------------------------------------------------------------
2498 Custom "actions", known to Privoxy as "aliases", can be defined by combining
2499 other "actions". These can in turn be invoked just like the built-in "actions".
2500 Currently, an alias can contain any character except space, tab, "=", "{" or "}
2501 ". But please use only "a"- "z", "0"-"9", "+", and "-". Alias names are not
2502 case sensitive, and must be defined before anything else in the
2503 default.actionfile! And there can only be one set of "aliases" defined.
2505 Now let's define a few aliases:
2507 # Useful custom aliases we can use later. These must come first!
2509 +no-cookies = +no-cookies-set +no-cookies-read
2510 -no-cookies = -no-cookies-set -no-cookies-read
2512 -block -no-cookies -filter -fast-redirects -hide-referer -no-popups
2513 shop = -no-cookies -filter -fast-redirects
2514 +imageblock = +block +image
2516 #For people who don't like to type too much: ;-)
2519 c2 = -no-cookies-set +no-cookies-read
2520 c3 = +no-cookies-set -no-cookies-read
2521 #... etc. Customize to your heart's content.
2524 Some examples using our "shop" and "fragile" aliases from above:
2526 # These sites are very complex and require
2527 # minimal interference.
2529 .office.microsoft.com
2530 .windowsupdate.microsoft.com
2533 # Shopping sites - but we still want to block ads.
2536 .worldpay.com # for quietpc.com
2540 # These shops require pop-ups also
2546 The "shop" and "fragile" aliases are often used for "problem" sites that
2547 require most actions to be disabled in order to function properly.
2549 -------------------------------------------------------------------------------
2551 5.5. The Filter File
2553 Any web page can be dynamically modified with the filter file. This
2554 modification can be removal, or re-writing, of any web page content, including
2555 tags and non-visible content. The default filter file is default.filter,
2556 located in the config directory.
2558 This is potentially a very powerful feature, and requires knowledge of both
2559 "regular expression" and HTML in order create custom filters. But, there are a
2560 number of useful filters included with Privoxy for many common situations.
2562 The included example file is divided into sections. Each section begins with
2563 the FILTER keyword, followed by the identifier for that section, e.g. "FILTER:
2564 webbugs". Each section performs a similar type of filtering, such as
2567 This file uses regular expressions to alter or remove any string in the target
2568 page. The expressions can only operate on one line at a time. Some examples
2569 from the included default default.filter:
2571 Stop web pages from displaying annoying messages in the status bar by deleting
2574 FILTER: html-annoyances
2576 # New browser windows should be resizeable and have a location and status
2579 s/resizable="?(no|0)"?/resizable=1/ig s/noresize/yesresize/ig
2580 s/location="?(no|0)"?/location=1/ig s/status="?(no|0)"?/status=1/ig
2581 s/scrolling="?(no|0|Auto)"?/scrolling=1/ig
2582 s/menubar="?(no|0)"?/menubar=1/ig
2584 # The <BLINK> tag was a crime!
2586 s*<blink>|</blink>**ig
2590 #s/framespacing="?(no|0)"?//ig
2591 #s/margin(height|width)=[0-9]*//gi
2594 Just for kicks, replace any occurrence of "Microsoft" with "MicroSuck", and
2595 have a little fun with topical buzzwords:
2599 s/microsoft(?!.com)/MicroSuck/ig
2603 s/industry-leading|cutting-edge|award-winning/<font color=red><b>BINGO!</b></
2607 Kill those pesky little web-bugs:
2609 # webbugs: Squish WebBugs (1x1 invisible GIFs used for user tracking)
2612 s/<img\s+[^>]*?(width|height)\s*=\s*['"]?1\D[^>]*?(width|height)\s*=\s*['"]?1
2613 (\D[^>]*?)?>/<!-- Squished WebBug -->/sig
2616 -------------------------------------------------------------------------------
2620 When Privoxy displays one of its internal pages, such as a 404 Not Found error
2621 page, it uses the appropriate template. On Linux, BSD, and Unix, these are
2622 located in /etc/privoxy/templates by default. These may be customized, if
2623 desired. cgi-style.css is used to control the HTML attributes (fonts, etc).
2625 The default "Blocked" banner page with the bright red top banner, is called
2626 just "blocked". This may be customized or replaced with something else if
2629 -------------------------------------------------------------------------------
2631 6. Contacting the Developers, Bug Reporting and Feature Requests
2633 We value your feedback. However, to provide you with the best support, please
2636 * Use the Sourceforge Support Forum to get help:
2638 http://sourceforge.net/tracker/?group_id=11118&atid=211118
2641 * Submit bugs only through our Sourceforge Bug Forum:
2643 http://sourceforge.net/tracker/?group_id=11118&atid=111118.
2646 Make sure that the bug has not already been submitted. Please try to verify
2647 that it is a Privoxy bug, and not a browser or site bug first. If you are
2648 using your own custom configuration, please try the stock configs to see if
2649 the problem is a configuration related bug. And if not using the latest
2650 development snapshot, please try the latest one. Or even better, CVS
2651 sources. Please be sure to include the Privoxy/Junkbuster version,
2652 platform, browser, any pertinent log data, any other relevant details
2653 (please be specific) and, if possible, some way to reproduce the bug.
2655 * Submit feature requests only through our Sourceforge feature request forum:
2657 http://sourceforge.net/tracker/?atid=361118&group_id=11118&func=browse.
2660 * You can also send feedback on websites that Privoxy has problems with. Please bookmark
2661 the following link: "Privoxy - Submit Filter Feedback"
2662 . Once you surf to a page with problems, use the
2663 bookmark to send us feedback. We will look into the issue as soon as possible.
2666 * For any other issues, feel free to use the mailing lists:
2668 http://sourceforge.net/mail/?group_id=11118.
2671 Anyone interested in actively participating in development and related
2672 discussions can also join the appropriate mailing list. Archives are
2675 -------------------------------------------------------------------------------
2677 6.1. Submitting Ads and "Action" Problems
2679 Ads and banners that are not stopped by Privoxy can be submitted to the
2680 developers by accessing a special page and filling out the brief, required
2681 form. Conversely, you can also report pages, images, etc. that Privoxy is
2682 blocking, but should not. The form itself does require Internet access.
2684 To do this, point your browser to Privoxy at http://config.privoxy.org/
2685 (shortcut: http://p.p/), and then select Actions file feedback system, near the
2686 bottom of the page. Paste in the URL that is the cause of the unwanted
2687 behavior, and follow the prompts. The developers will try to incorporate a fix
2688 for the problem you reported into future versions.
2690 New default.actions files will occasionally be made available based on your
2691 feedback. These will be announced on the ijbswa-announce list.
2693 -------------------------------------------------------------------------------
2695 7. Copyright and History
2699 Privoxy is free software; you can redistribute it and/or modify it under the
2700 terms of the GNU General Public License as published by the Free Software
2701 Foundation; either version 2 of the License, or (at your option) any later
2704 This program is distributed in the hope that it will be useful, but WITHOUT ANY
2705 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
2706 PARTICULAR PURPOSE. See the GNU General Public License for more details, which
2707 is available from the Free Software Foundation, Inc, 59 Temple Place - Suite
2708 330, Boston, MA 02111-1307, USA.
2710 You should have received a copy of the GNU General Public License along with
2711 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
2712 Place, Suite 330, Boston, MA 02111-1307 USA.
2714 -------------------------------------------------------------------------------
2718 Privoxy is evolved, and derived from, the Internet Junkbuster, with many
2719 improvments and enhancements over the original.
2721 Junkbuster was originally written by Anonymous Coders and Junkbusters
2722 Corporation, and was released as free open-source software under the GNU GPL.
2723 Stefan Waldherr made many improvements, and started the SourceForge project
2724 Privoxy to rekindle development. There are now several active developers
2725 contributing. The last stable release of Junkbuster was v2.0.2, which has now
2728 -------------------------------------------------------------------------------
2732 Other references and sites of interest to Privoxy users:
2734 http://www.privoxy.org/, The Privoxy Home page.
2736 http://sourceforge.net/projects/ijbswa, the Project Page for Privoxy on
2739 http://p.p/, access Privoxy from your browser. Alternately, http://
2740 config.privoxy.org may work in some situations where the first does not.
2742 http://p.p/, and select "actions file feedback system" to submit "misses" to
2745 http://www.junkbusters.com/ht/en/cookies.html
2747 http://www.waldherr.org/junkbuster/
2749 http://privacy.net/analyze/
2751 http://www.squid-cache.org/
2755 -------------------------------------------------------------------------------
2759 9.1. Regular Expressions
2761 Privoxy can use "regular expressions" in various config files. Assuming support
2762 for "pcre" (Perl Compatible Regular Expressions) is compiled in, which is the
2763 default. Such configuration directives do not require regular expressions, but
2764 they can be used to increase flexibility by matching a pattern with wild-cards
2767 If you are reading this, you probably don't understand what "regular
2768 expressions" are, or what they can do. So this will be a very brief
2769 introduction only. A full explanation would require a book ;-)
2771 "Regular expressions" is a way of matching one character expression against
2772 another to see if it matches or not. One of the "expressions" is a literal
2773 string of readable characters (letter, numbers, etc), and the other is a
2774 complex string of literal characters combined with wild-cards, and other
2775 special characters, called meta-characters. The "meta-characters" have special
2776 meanings and are used to build the complex pattern to be matched against. Perl
2777 Compatible Regular Expressions is an enhanced form of the regular expression
2778 language with backward compatibility.
2780 To make a simple analogy, we do something similar when we use wild-card
2781 characters when listing files with the dir command in DOS. *.* matches all
2782 filenames. The "special" character here is the asterisk which matches any and
2783 all characters. We can be more specific and use ? to match just individual
2784 characters. So "dir file?.text" would match "file1.txt", "file2.txt", etc. We
2785 are pattern matching, using a similar technique to "regular expressions"!
2787 Regular expressions do essentially the same thing, but are much, much more
2788 powerful. There are many more "special characters" and ways of building complex
2789 patterns however. Let's look at a few of the common ones, and then some
2792 . - Matches any single character, e.g. "a", "A", "4", ":", or "@".
2794 ? - The preceding character or expression is matched ZERO or ONE times. Either/
2797 + - The preceding character or expression is matched ONE or MORE times.
2799 * - The preceding character or expression is matched ZERO or MORE times.
2801 \ - The "escape" character denotes that the following character should be taken
2802 literally. This is used where one of the special characters (e.g. ".") needs to
2803 be taken literally and not as a special meta-character. Example: "example
2804 \.com", makes sure the period is recognized only as a period (and not expanded
2805 to its metacharacter meaning of any single character).
2807 [] - Characters enclosed in brackets will be matched if any of the enclosed
2808 characters are encountered. For instance, "[0-9]" matches any numeric digit
2809 (zero through nine). As an example, we can combine this with "+" to match any
2810 digit one of more times: "[0-9]+".
2812 () - parentheses are used to group a sub-expression, or multiple
2815 | - The "bar" character works like an "or" conditional statement. A match is
2816 successful if the sub-expression on either side of "|" matches. As an example:
2817 "/(this|that) example/" uses grouping and the bar character and would match
2818 either "this example" or "that example", and nothing else.
2820 s/string1/string2/g - This is used to rewrite strings of text. "string1" is
2821 replaced by "string2" in this example. There must of course be a match on
2824 These are just some of the ones you are likely to use when matching URLs with
2825 Privoxy, and is a long way from a definitive list. This is enough to get us
2826 started with a few simple examples which may be more illuminating:
2828 /.*/banners/.* - A simple example that uses the common combination of "." and "
2829 *" to denote any character, zero or more times. In other words, any string at
2830 all. So we start with a literal forward slash, then our regular expression
2831 pattern (".*") another literal forward slash, the string "banners", another
2832 forward slash, and lastly another ".*". We are building a directory path here.
2833 This will match any file with the path that has a directory named "banners" in
2834 it. The ".*" matches any characters, and this could conceivably be more forward
2835 slashes, so it might expand into a much longer looking path. For example, this
2836 could match: "/eye/hate/spammers/banners/annoy_me_please.gif", or just "/
2837 banners/annoying.html", or almost an infinite number of other possible
2838 combinations, just so it has "banners" in the path somewhere.
2840 A now something a little more complex:
2842 /.*/adv((er)?ts?|ertis(ing|ements?))?/ - We have several literal forward
2843 slashes again ("/"), so we are building another expression that is a file path
2844 statement. We have another ".*", so we are matching against any conceivable
2845 sub-path, just so it matches our expression. The only true literal that must
2846 match our pattern is adv, together with the forward slashes. What comes after
2847 the "adv" string is the interesting part.
2849 Remember the "?" means the preceding expression (either a literal character or
2850 anything grouped with "(...)" in this case) can exist or not, since this means
2851 either zero or one match. So "((er)?ts?|ertis(ing|ements?))" is optional, as
2852 are the individual sub-expressions: "(er)", "(ing|ements?)", and the "s". The "
2853 |" means "or". We have two of those. For instance, "(ing|ements?)", can expand
2854 to match either "ing" OR "ements?". What is being done here, is an attempt at
2855 matching as many variations of "advertisement", and similar, as possible. So
2856 this would expand to match just "adv", or "advert", or "adverts", or
2857 "advertising", or "advertisement", or "advertisements". You get the idea. But
2858 it would not match "advertizements" (with a "z"). We could fix that by changing
2859 our regular expression to: "/.*/adv((er)?ts?|erti(s|z)(ing|ements?))?/", which
2860 would then match either spelling.
2862 /.*/advert[0-9]+\.(gif|jpe?g) - Again another path statement with forward
2863 slashes. Anything in the square brackets "[]" can be matched. This is using
2864 "0-9" as a shorthand expression to mean any digit one through nine. It is the
2865 same as saying "0123456789". So any digit matches. The "+" means one or more of
2866 the preceding expression must be included. The preceding expression here is
2867 what is in the square brackets -- in this case, any digit one through nine.
2868 Then, at the end, we have a grouping: "(gif|jpe?g)". This includes a "|", so
2869 this needs to match the expression on either side of that bar character also. A
2870 simple "gif" on one side, and the other side will in turn match either "jpeg"
2871 or "jpg", since the "?" means the letter "e" is optional and can be matched
2872 once or not at all. So we are building an expression here to match image GIF or
2873 JPEG type image file. It must include the literal string "advert", then one or
2874 more digits, and a "." (which is now a literal, and not a special character,
2875 since it is escaped with "\"), and lastly either "gif", or "jpeg", or "jpg".
2876 Some possible matches would include: "//advert1.jpg", "/nasty/ads/
2877 advert1234.gif", "/banners/from/hell/advert99.jpg". It would not match
2878 "advert1.gif" (no leading slash), or "/adverts232.jpg" (the expression does not
2879 include an "s"), or "/advert1.jsp" ("jsp" is not in the expression anywhere).
2881 s/microsoft(?!.com)/MicroSuck/i - This is a substitution. "MicroSuck" will
2882 replace any occurrence of "microsoft". The "i" at the end of the expression
2883 means ignore case. The "(?!.com)" means the match should fail if "microsoft" is
2884 followed by ".com". In other words, this acts like a "NOT" modifier. In case
2885 this is a hyperlink, we don't want to break it ;-).
2887 We are barely scratching the surface of regular expressions here so that you
2888 can understand the default Privoxy configuration files, and maybe use this
2889 knowledge to customize your own installation. There is much, much more that can
2890 be done with regular expressions. Now that you know enough to get started, you
2891 can learn more on your own :/
2893 More reading on Perl Compatible Regular expressions: http://www.perldoc.com/
2894 perl5.6/pod/perlre.html
2896 -------------------------------------------------------------------------------
2898 9.2. Privoxy's Internal Pages
2900 Since Privoxy proxies each requested web page, it is easy for Privoxy to trap
2901 certain special URLs. In this way, we can talk directly to Privoxy, and see how
2902 it is configured, see how our rules are being applied, change these rules and
2903 other configuration options, and even turn Privoxy's filtering off, all with a
2906 The URLs listed below are the special ones that allow direct access to Privoxy.
2907 Of course, Privoxy must be running to access these. If not, you will get a
2908 friendly error message. Internet access is not necessary either.
2910 * Privoxy main page:
2912 http://config.privoxy.org/
2914 Alternately, this may be reached at http://p.p/, but this variation may not
2915 work as reliably as the above in some configurations.
2917 * Show information about the current configuration:
2919 http://config.privoxy.org/show-status
2921 * Show the source code version numbers:
2923 http://config.privoxy.org/show-version
2925 * Show the client's request headers:
2927 http://config.privoxy.org/show-request
2929 * Show which actions apply to a URL and why:
2931 http://config.privoxy.org/show-url-info
2933 * Toggle Privoxy on or off. In this case, "Privoxy" continues to run, but
2934 only as a pass-through proxy, with no actions taking place:
2936 http://config.privoxy.org/toggle
2938 Short cuts. Turn off, then on:
2940 http://config.privoxy.org/toggle?set=disable
2942 http://config.privoxy.org/toggle?set=enable
2944 * Edit the actions list file:
2946 http://config.privoxy.org/edit-actions
2948 These may be bookmarked for quick reference. See next.
2950 -------------------------------------------------------------------------------
2954 Below are some "bookmarklets" to allow you to easily access a "mini" version of
2955 some of Privoxy's special pages. They are designed for MS Internet Explorer,
2956 but should work equally well in Netscape, Mozilla, and other browsers which
2957 support JavaScript. They are designed to run directly from your bookmarks - not
2958 by clicking the links below (although that should work for testing).
2960 To save them, right-click the link and choose "Add to Favorites" (IE) or "Add
2961 Bookmark" (Netscape). You will get a warning that the bookmark "may not be
2962 safe" - just click OK. Then you can run the Bookmarklet directly from your
2963 favorites/bookmarks. For even faster access, you can put them on the "Links"
2964 bar (IE) or the "Personal Toolbar" (Netscape), and run them with a single
2971 * Toggle Privoxy (Toggles between enabled and disabled)
2973 * View Privoxy Status
2975 * Actions file feedback system
2977 Credit: The site which gave me the general idea for these bookmarklets is
2978 www.bookmarklets.com. They have more information about bookmarklets.
2980 -------------------------------------------------------------------------------
2982 9.3. Chain of Events
2984 Let's take a quick look at the basic sequence of events when a web page is
2985 requested by your browser and Privoxy is on duty:
2987 * First, the web browser requests a page, and this request is intercepted by
2988 Privoxy immediately.
2990 * Privoxy traps any request for internal CGI pages (e.g http://p.p/) and
2991 relays these back to the browser.
2993 * If the URL matches a "+block" pattern, then it is blocked and the banner
2996 * Untrusted URLs are blocked. If URLs are being added to the trust file, then
2999 * "+fast-redirect" is processed, stripping unwanted parts of the request web
3002 * At this point, Privoxy relays the request to the web server, and requests
3003 the page (assuming nothing up to this point has prevented getting us from
3006 * The first few hundred bytes are read from the web server and "+kill-popups"
3007 is processed, if enabled.
3009 * If "+filter" applies, the rest of the page is read into memory and then the
3010 filters are processed. Filters are applied in the order they are specified
3011 in the default.filter file. The entire page, which is now filtered, is then
3012 sent by Privoxy to your browser.
3014 * As the browser receives the filtered page content, it will read and request
3015 any embedded URLs on the page, e.g. an ad image. As the browser requests
3016 these secondary URLs from whatever server they may be on, Privoxy handles
3017 these same as above, and the process is repeated for each such URL. Note
3018 that a fancy web page may have many, many such URLs for graphics, frames,
3021 -------------------------------------------------------------------------------
3023 9.4. Anatomy of an Action
3025 The way Privoxy applies "actions" and "filters" to any given URL can be
3026 complex, and not always so easy to understand what is happening. And sometimes
3027 we need to be able to see just what Privoxy is doing. Especially, if something
3028 Privoxy is doing is causing us a problem inadvertently. It can be a little
3029 daunting to look at the actions and filters files themselves, since they tend
3030 to be filled with "regular expressions" whose consequences are not always so
3033 One quick test to see if Privoxy is causing a problem or not, is to disable it
3034 temporarily. This should be the first troubleshooting step. See the
3035 Bookmarklets section on a quick and easy way to do this (be sure to flush
3036 caches afterwards!).
3038 Privoxy also provides the http://config.privoxy.org/show-url-info page that can
3039 show us very specifically how actions are being applied to any given URL. This
3040 is a big help for troubleshooting.
3042 First, enter one URL (or partial URL) at the prompt, and then Privoxy will tell
3043 us how the current configuration will handle it. This will not help with
3044 filtering effects (i.e. the "+filter" action) from the default.filter file
3045 since this is handled very differently and not so easy to trap! It also will
3046 not tell you about any other URLs that may be embedded within the URL you are
3047 testing (i.e. a web page). For instance, images such as ads are expressed as
3048 URLs within the raw page source of HTML pages. So you will only get info for
3049 the actual URL that is pasted into the prompt area -- not any sub-URLs. If you
3050 want to know about embedded URLs like ads, you will have to dig those out of
3051 the HTML source. Use your browser's "View Page Source" option for this. Or
3052 right click on the ad, and grab the URL.
3054 Let's look at an example, google.com, one section at a time:
3056 System default actions:
3058 { -add-header -block -deanimate-gifs -downgrade -fast-redirects -filter
3059 -hide-forwarded -hide-from -hide-referer -hide-user-agent -image
3060 -image-blocker -limit-connect -no-compression -no-cookies-keep
3061 -no-cookies-read -no-cookies-set -no-popups -vanilla-wafer -wafer }
3065 This is the top section, and only tells us of the compiled in defaults. This is
3066 basically what Privoxy would do if there were not any "actions" defined, i.e.
3067 it does nothing. Every action is disabled. This is not particularly informative
3068 for our purposes here. OK, next section:
3070 Matches for http://google.com:
3072 { -add-header -block +deanimate-gifs -downgrade +fast-redirects
3073 +filter{html-annoyances} +filter{js-annoyances} +filter{no-popups}
3074 +filter{webbugs} +filter{nimda} +filter{banners-by-size} +filter{hal}
3075 +filter{fun} +hide-forwarded +hide-from{block} +hide-referer{forge}
3076 -hide-user-agent -image +image-blocker{blank} +no-compression
3077 +no-cookies-keep -no-cookies-read -no-cookies-set +no-popups
3078 -vanilla-wafer -wafer }
3081 { -no-cookies-keep -no-cookies-read -no-cookies-set }
3089 This is much more informative, and tells us how we have defined our "actions",
3090 and which ones match for our example, "google.com". The first grouping shows
3091 our default settings, which would apply to all URLs. If you look at your
3092 "actions" file, this would be the section just below the "aliases" section near
3093 the top. This applies to all URLs as signified by the single forward slash -- "
3096 These are the default actions we have enabled. But we can define additional
3097 actions that would be exceptions to these general rules, and then list specific
3098 URLs that these exceptions would apply to. Last match wins. Just below this
3099 then are two explicit matches for ".google.com". The first is negating our
3100 various cookie blocking actions (i.e. we will allow cookies here). The second
3101 is allowing "fast-redirects". Note that there is a leading dot here --
3102 ".google.com". This will match any hosts and sub-domains, in the google.com
3103 domain also, such as "www.google.com". So, apparently, we have these actions
3104 defined somewhere in the lower part of our actions file, and "google.com" is
3105 referenced in these sections.
3107 And now we pull it altogether in the bottom section and summarize how Privoxy
3108 is applying all its "actions" to "google.com":
3112 -add-header -block -deanimate-gifs -downgrade -fast-redirects
3113 +filter{html-annoyances} +filter{js-annoyances} +filter{no-popups}
3114 +filter{webbugs} +filter{nimda} +filter{banners-by-size} +filter{hal}
3115 +filter{fun} +hide-forwarded +hide-from{block} +hide-referer{forge}
3116 -hide-user-agent -image +image-blocker{blank} -limit-connect +no-compression
3117 -no-cookies-keep -no-cookies-read -no-cookies-set +no-popups -vanilla-wafer
3122 Now another example, "ad.doubleclick.net":
3135 We'll just show the interesting part here, the explicit matches. It is matched
3136 three different times. Each as an "+block +image", which is the expanded form
3137 of one of our aliases that had been defined as: "+imageblock". ("Aliases" are
3138 defined in the first section of the actions file and typically used to combine
3139 more than one action.)
3141 Any one of these would have done the trick and blocked this as an unwanted
3142 image. This is unnecessarily redundant since the last case effectively would
3143 also cover the first. No point in taking chances with these guys though ;-)
3144 Note that if you want an ad or obnoxious URL to be invisible, it should be
3145 defined as "ad.doubleclick.net" is done here -- as both a "+block" and an
3146 "+image". The custom alias "+imageblock" does this for us.
3148 One last example. Let's try "http://www.rhapsodyk.net/adsl/HOWTO/". This one is
3149 giving us problems. We are getting a blank page. Hmmm...
3151 Matches for http://www.rhapsodyk.net/adsl/HOWTO/:
3153 { -add-header -block +deanimate-gifs -downgrade +fast-redirects
3154 +filter{html-annoyances} +filter{js-annoyances} +filter{no-popups}
3155 +filter{webbugs} +filter{nimda} +filter{banners-by-size} +filter{hal}
3156 +filter{fun} +hide-forwarded +hide-from{block} +hide-referer{forge}
3157 -hide-user-agent -image +image-blocker{blank} +no-compression
3158 +no-cookies-keep -no-cookies-read -no-cookies-set +no-popups
3159 -vanilla-wafer -wafer }
3167 Ooops, the "/adsl/" is matching "/ads"! But we did not want this at all! Now we
3168 see why we get the blank page. We could now add a new action below this that
3169 explicitly does not block (-block) pages with "adsl". There are various ways to
3170 handle such exceptions. Example:
3177 Now the page displays ;-) Be sure to flush your browser's caches when making
3178 such changes. Or, try using Shift+Reload.
3180 But now what about a situation where we get no explicit matches like we did
3188 That actually was very telling and pointed us quickly to where the problem was.
3189 If you don't get this kind of match, then it means one of the default rules in
3190 the first section is causing the problem. This would require some guesswork,
3191 and maybe a little trial and error to isolate the offending rule. One likely
3192 cause would be one of the "{+filter}" actions. Try adding the URL for the site
3193 to one of aliases that turn off "+filter":
3197 .worldpay.com # for quietpc.com
3204 "{shop}" is an "alias" that expands to "{ -filter -no-cookies -no-cookies-keep
3205 }". Or you could do your own exception to negate filtering:
3212 "{fragile}" is an alias that disables most actions. This can be used as a last
3213 resort for problem sites. Remember to flush caches! If this still does not
3214 work, you will have to go through the remaining actions one by one to find
3215 which one(s) is causing the problem.