Regenerate docs for upcoming 3.0.1 release.
[privoxy.git] / doc / text / user-manual.txt
1 Privoxy 3.0.1 User Manual
2
3 Copyright © 2001, 2002 by Privoxy Developers
4
5 $Id: user-manual.sgml,v 1.123.2.27 2003/03/18 19:37:14 oes Exp $
6
7 The User Manual gives users information on how to install, configure and use 
8 Privoxy.
9
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
15 networks.
16
17 Privoxy is based on Internet Junkbuster (tm).
18
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.
21
22 -------------------------------------------------------------------------------
23
24 Table of Contents
25 1. Introduction
26    
27     1.1. Features
28    
29 2. Installation
30    
31     2.1. Binary Packages
32        
33         2.1.1. Red Hat, SuSE and Conectiva RPMs
34         2.1.2. Debian
35         2.1.3. Windows
36         2.1.4. Solaris, NetBSD, FreeBSD, HP-UX
37         2.1.5. OS/2
38         2.1.6. Mac OSX
39         2.1.7. AmigaOS
40         2.1.8. Gentoo
41        
42     2.2. Building from Source
43     2.3. Keeping your Installation Up-to-Date
44    
45 3. Note to Upgraders
46 4. Quickstart to Using Privoxy
47    
48     4.1. Quickstart to Ad Blocking
49    
50 5. Starting Privoxy
51    
52     5.1. Red Hat and Conectiva
53     5.2. Debian
54     5.3. SuSE
55     5.4. Windows
56     5.5. Solaris, NetBSD, FreeBSD, HP-UX and others
57     5.6. OS/2
58     5.7. Mac OSX
59     5.8. AmigaOS
60     5.9. Gentoo
61     5.10. Command Line Options
62    
63 6. Privoxy Configuration
64    
65     6.1. Controlling Privoxy with Your Web Browser
66     6.2. Configuration Files Overview
67    
68 7. The Main Configuration File
69    
70     7.1. Configuration and Log File Locations
71        
72         7.1.1. confdir
73         7.1.2. logdir
74         7.1.3. actionsfile
75         7.1.4. filterfile
76         7.1.5. logfile
77         7.1.6. jarfile
78         7.1.7. trustfile
79        
80     7.2. Local Set-up Documentation
81        
82         7.2.1. user-manual
83         7.2.2. trust-info-url
84         7.2.3. admin-address
85         7.2.4. proxy-info-url
86        
87     7.3. Debugging
88        
89         7.3.1. debug
90         7.3.2. single-threaded
91        
92     7.4. Access Control and Security
93        
94         7.4.1. listen-address
95         7.4.2. toggle
96         7.4.3. enable-remote-toggle
97         7.4.4. enable-edit-actions
98         7.4.5. ACLs: permit-access and deny-access
99         7.4.6. buffer-limit
100        
101     7.5. Forwarding
102        
103         7.5.1. forward
104         7.5.2. forward-socks4 and forward-socks4a
105         7.5.3. Advanced Forwarding Examples
106        
107     7.6. Windows GUI Options
108    
109 8. Actions Files
110    
111     8.1. Finding the Right Mix
112     8.2. How to Edit
113     8.3. How Actions are Applied to URLs
114     8.4. Patterns
115        
116         8.4.1. The Domain Pattern
117         8.4.2. The Path Pattern
118        
119     8.5. Actions
120        
121         8.5.1. add-header
122         8.5.2. block
123         8.5.3. crunch-incoming-cookies
124         8.5.4. crunch-outgoing-cookies
125         8.5.5. deanimate-gifs
126         8.5.6. downgrade-http-version
127         8.5.7. fast-redirects
128         8.5.8. filter
129         8.5.9. handle-as-image
130         8.5.10. hide-forwarded-for-headers
131         8.5.11. hide-from-header
132         8.5.12. hide-referrer
133         8.5.13. hide-user-agent
134         8.5.14. kill-popups
135         8.5.15. limit-connect
136         8.5.16. prevent-compression
137         8.5.17. send-vanilla-wafer
138         8.5.18. send-wafer
139         8.5.19. session-cookies-only
140         8.5.20. set-image-blocker
141         8.5.21. Summary
142        
143     8.6. Aliases
144     8.7. Actions Files Tutorial
145        
146         8.7.1. default.action
147         8.7.2. user.action
148        
149 9. The Filter File
150    
151     9.1. Filter File Tutorial
152    
153 10. Templates
154 11. Contacting the Developers, Bug Reporting and Feature Requests
155    
156     11.1. Get Support
157     11.2. Report Bugs
158     11.3. Request New Features
159     11.4. Report Ads or Other Actions-Related Problems
160     11.5. Other
161    
162 12. Privoxy Copyright, License and History
163    
164     12.1. License
165     12.2. History
166     12.3. Authors
167    
168 13. See Also
169 14. Appendix
170    
171     14.1. Regular Expressions
172     14.2. Privoxy's Internal Pages
173        
174         14.2.1. Bookmarklets
175        
176     14.3. Chain of Events
177     14.4. Anatomy of an Action
178    
179 1. Introduction
180
181 This documentation is included with the current stable version of Privoxy,
182 v.3.0.1.
183
184 -------------------------------------------------------------------------------
185
186 1.1. Features
187
188 In addition to Internet Junkbuster's traditional features of ad and banner
189 blocking and cookie management, Privoxy provides new features:
190
191   * Integrated browser based configuration and control utility at http://
192     config.privoxy.org/ (shortcut: http://p.p/). Browser-based tracing of rule
193     and filter effects. Remote toggling.
194    
195   * Web page content filtering (removes banners based on size, invisible
196     "web-bugs", JavaScript and HTML annoyances, pop-up windows, etc.)
197    
198   * Modularized configuration that allows for standard settings and user
199     settings to reside in separate files, so that installing updated actions
200     files won't overwrite individual user settings.
201    
202   * HTTP/1.1 compliant (but not all optional 1.1 features are supported).
203    
204   * Support for Perl Compatible Regular Expressions in the configuration files,
205     and generally a more sophisticated and flexible configuration syntax over
206     previous versions.
207    
208   * Improved cookie management features (e.g. session based cookies).
209    
210   * GIF de-animation.
211    
212   * Bypass many click-tracking scripts (avoids script redirection).
213    
214   * Multi-threaded (POSIX and native threads).
215    
216   * User-customizable HTML templates for all proxy-generated pages (e.g.
217     "blocked" page).
218    
219   * Auto-detection and re-reading of config file changes.
220    
221   * Improved signal handling, and a true daemon mode (Unix).
222    
223   * Every feature now controllable on a per-site or per-location basis,
224     configuration more powerful and versatile over-all.
225    
226   * Many smaller new features added, limitations and bugs removed, and security
227     holes fixed.
228    
229 -------------------------------------------------------------------------------
230
231 2. Installation
232
233 Privoxy is available both in convenient pre-compiled packages for a wide range
234 of operating systems, and as raw source code. For most users, we recommend
235 using the packages, which can be downloaded from our Privoxy Project Page.
236
237 Note: If you have a previous Junkbuster or Privoxy installation on your system,
238 you will need to remove it. On some platforms, this may be done for you as part
239 of their installation procedure. (See below for your platform). In any case be
240 sure to backup your old configuration if it is valuable to you. See the note to
241 upgraders section below.
242
243 -------------------------------------------------------------------------------
244
245 2.1. Binary Packages
246
247 How to install the binary packages depends on your operating system:
248
249 -------------------------------------------------------------------------------
250
251 2.1.1. Red Hat, SuSE and Conectiva RPMs
252
253 RPMs can be installed with rpm -Uvh privoxy-3.0.1-1.rpm, and will use /etc/
254 privoxy for the location of configuration files.
255
256 Note that on Red Hat, Privoxy will not be automatically started on system boot.
257 You will need to enable that using chkconfig, ntsysv, or similar methods. Note
258 that SuSE will automatically start Privoxy in the boot process.
259
260 If you have problems with failed dependencies, try rebuilding the SRC RPM: rpm
261 --rebuild privoxy-3.0.1-1.src.rpm. This will use your locally installed
262 libraries and RPM version.
263
264 Also note that if you have a Junkbuster RPM installed on your system, you need
265 to remove it first, because the packages conflict. Otherwise, RPM will try to
266 remove Junkbuster automatically, before installing Privoxy.
267
268 -------------------------------------------------------------------------------
269
270 2.1.2. Debian
271
272 DEBs can be installed with dpkg -i privoxy_3.0.1-1.deb, and will use /etc/
273 privoxy for the location of configuration files.
274
275 -------------------------------------------------------------------------------
276
277 2.1.3. Windows
278
279 Just double-click the installer, which will guide you through the installation
280 process. You will find the configuration files in the same directory as you
281 installed Privoxy in. We do not use the registry of Windows.
282
283 -------------------------------------------------------------------------------
284
285 2.1.4. Solaris, NetBSD, FreeBSD, HP-UX
286
287 Create a new directory, cd to it, then unzip and untar the archive. For the
288 most part, you'll have to figure out where things go.
289
290 -------------------------------------------------------------------------------
291
292 2.1.5. OS/2
293
294 First, make sure that no previous installations of Junkbuster and / or Privoxy
295 are left on your system. Check that no Junkbuster or Privoxy objects are in
296 your startup folder. 
297
298 Then, just double-click the WarpIN self-installing archive, which will guide
299 you through the installation process. A shadow of the Privoxy executable will
300 be placed in your startup folder so it will start automatically whenever OS/2
301 starts.
302
303 The directory you choose to install Privoxy into will contain all of the
304 configuration files.
305
306 -------------------------------------------------------------------------------
307
308 2.1.6. Mac OSX
309
310 Unzip the downloaded file (you can either double-click on the file from the
311 finder, or from the desktop if you downloaded it there). Then, double-click on
312 the package installer icon named Privoxy.pkg and follow the installation
313 process. Privoxy will be installed in the folder /Library/Privoxy. It will
314 start automatically whenever you start up. To prevent it from starting
315 automatically, remove or rename the folder /Library/StartupItems/Privoxy.
316
317 To start Privoxy by hand, double-click on StartPrivoxy.command in the /Library/
318 Privoxy folder. Or, type this command in the Terminal:
319
320   /Library/Privoxy/StartPrivoxy.command                                        
321                                                                                
322
323 You will be prompted for the administrator password.
324
325 -------------------------------------------------------------------------------
326
327 2.1.7. AmigaOS
328
329 Copy and then unpack the lha archive to a suitable location. All necessary
330 files will be installed into Privoxy directory, including all configuration and
331 log files. To uninstall, just remove this directory.
332
333 -------------------------------------------------------------------------------
334
335 2.1.8. Gentoo
336
337 Gentoo source packages (Ebuilds) for Privoxy are contained in the Gentoo
338 Portage Tree (they are not on the download page, but there is a Gentoo section,
339 where you can see when a new Privoxy Version is added to the Portage Tree).
340
341 Before installing Privoxy under Gentoo just do first emerge rsync to get the
342 latest changes from the Portage tree. With emerge privoxy you install the
343 latest version.
344
345 Configuration files are in /etc/privoxy, the documentation is in /usr/share/doc
346 /privoxy-3.0.1 and the Log directory is in /var/log/privoxy.
347
348 -------------------------------------------------------------------------------
349
350 2.2. Building from Source
351
352 The most convenient way to obtain the Privoxy sources is to download the source
353 tarball from our project page.
354
355 If you like to live on the bleeding edge and are not afraid of using possibly
356 unstable development versions, you can check out the up-to-the-minute version
357 directly from the CVS repository or simply download the nightly CVS tarball.
358
359 To build Privoxy from source, autoconf, GNU make (gmake), and, of course, a C
360 compiler like gcc are required.
361
362 When building from a source tarball (either release version or nightly CVS
363 tarball), first unpack the source:
364
365  tar xzvf privoxy-3.0.1-src* [.tgz or .tar.gz]                                 
366  cd privoxy-3.0.1                                                              
367
368 For retrieving the current CVS sources, you'll need CVS installed. Note that
369 sources from CVS are development quality, and may not be stable, or well
370 tested. To download CVS source:
371
372   cvs -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa login          
373   cvs -z3 -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa co current 
374   cd current                                                                         
375
376 This will create a directory named current/, which will contain the source
377 tree.
378
379 You can also check out any Privoxy "branch", just exchange the current name
380 with the wanted branch name (Example: v_3_0_branch for the 3.0 cvs tree).
381
382 It is also strongly recommended to not run Privoxy as root, and instead it is
383 suggested to create a "privoxy" user and group for this purpose. See your local
384 documentation for the correct command line to do this.
385
386 /etc/passwd might then look like:
387
388   privoxy:*:7777:7777:privoxy proxy:/no/home:/no/shell                         
389
390 And then /etc/group, like:
391
392   privoxy:*:7777:                                                              
393
394 Some binary packages may do this for you.
395
396 Then, to build from either unpacked tarball or CVS source:
397
398  autoheader                                                                    
399  autoconf                                                                      
400  ./configure      # (--help to see options)                                    
401  make             # (the make from gnu, gmake for *BSD)                        
402  su                                                                            
403  make -n install  # (to see where all the files will go)                       
404  make -s install  # (to really install, -s to silence output)                  
405
406 If you have GNU make, you can have the first four steps automatically done for
407 you by just typing:
408
409   make                                                                         
410
411 in the freshly downloaded or unpacked source directory.
412
413 WARNING: If installing as root, the install will fail unless another user is
414 specified. configure accepts --with-user and --with-group options for setting
415 user and group ownership of the configuration files (which need to be writable
416 by the daemon). The specified user must already exist. Or if there is already a
417 privoxy user on the system, and no user was specified during configure, make
418 install then will use the privoxy user. When starting Privoxy, it should be run
419 as this same user that owns the configuration and log files.
420
421 Alternately, you can specify user and group on the make command line, but be
422 sure both already exist:
423
424  make -s install  USER=privoxy GROUP=privoxy                                   
425
426 If no group is specified, the install will assume a group exists with the same
427 name as the specified user.
428
429 The default installation path for make install is /usr/local. This may of
430 course be customized with the various ./configure path options. If you are
431 doing a root install to anywhere else besides /usr/local, be sure to set the
432 appropriate paths with the correct configure options (./configure --help).
433
434 If you do install to /usr/local, the install will use sysconfdir=$prefix/etc/
435 privoxy by default. All other destinations, and the direct usage of
436 --sysconfdir flag behave like normal, i.e. will not add the extra privoxy
437 directory. This is for a safer install, as there may already exist another
438 program that uses a file with the "config" name, and thus makes /usr/local/etc
439 cleaner.
440
441 If installing to /usr/local, the docs will go by default to $prefix/share/doc.
442 But if this directory doesn't exist, it will then try $prefix/doc and install
443 there before creating a new $prefix/share/doc just for Privoxy.
444
445 Again, if the installs goes to /usr/local, the localstatedir (ie: var/) will
446 default to /var instead of $prefix/var so the logs will go to /var/log/privoxy
447 /, and the pid file will be created in /var/run/privoxy.pid.
448
449 make install will attempt to set the correct values in config (main
450 configuration file). You may want to check this to make sure all values are
451 correct. If appropriate, an init script will be installed, but it is up to the
452 user to determine how and where to start Privoxy. The init script should be
453 checked for correct paths and values, if anything other than a default install
454 is done.
455
456 If install finds previous versions of any configuration files, these will not
457 be overwritten, and the new ones will be installed with a "new" extension. You
458 will then need to manually update the installed configuration files as needed.
459 All template files will be overwritten. If you have customized, local
460 templates, you should save these first. If a previous version of Privoxy is
461 already running, you will have to restart it manually.
462
463 For more detailed instructions on how to build Redhat and SuSE RPMs, Windows
464 self-extracting installers, building on platforms with special requirements
465 etc, please consult the developer manual.
466
467 -------------------------------------------------------------------------------
468
469 2.3. Keeping your Installation Up-to-Date
470
471 As user feedback comes in and development continues, we will make updated
472 versions of both the main actions file (as a separate package) and the software
473 itself (including the actions file) available for download.
474
475 If you wish to receive an email notification whenever we release updates of
476 Privoxy or the actions file, subscribe to our announce mailing list,
477 ijbswa-announce@lists.sourceforge.net.
478
479 In order not to loose your personal changes and adjustments when updating to
480 the latest default.action file we strongly recommend that you use user.action
481 for your customization of Privoxy. See the Chapter on actions files for
482 details.
483
484 -------------------------------------------------------------------------------
485
486 3. Note to Upgraders
487
488 There are very significant changes from earlier Junkbuster versions to the
489 current Privoxy. The number, names, syntax, and purposes of configuration files
490 have substantially changed. Junkbuster 2.0.x configuration files will not
491 migrate, Junkbuster 2.9.x and Privoxy configurations will need to be ported.
492 The functionalities of the old blockfile, cookiefile and imagelist are now
493 combined into the "actions files". default.action, is the main actions file.
494 Local exceptions should best be put into user.action.
495
496 A "filter file" (typically default.filter) is new as of Privoxy 2.9.x, and
497 provides some of the new sophistication (explained below). config is much the
498 same as before.
499
500 If upgrading from a 2.0.x version, you will have to use the new config files,
501 and possibly adapt any personal rules from your older files. When porting
502 personal rules over from the old blockfile to the new actions files, please
503 note that even the pattern syntax has changed. If upgrading from 2.9.x
504 development versions, it is still recommended to use the new configuration
505 files.
506
507 A quick list of things to be aware of before upgrading:
508
509   * The default listening port is now 8118 due to a conflict with another
510     service (NAS).
511    
512   * Some installers may remove earlier versions completely. Save any important
513     configuration files!
514    
515   * Privoxy is controllable with a web browser at the special URL: http://
516     config.privoxy.org/ (Shortcut: http://p.p/). Many aspects of configuration
517     can be done here, including temporarily disabling Privoxy.
518    
519   * The primary configuration files for cookie management, ad and banner
520     blocking, and many other aspects of Privoxy configuration are the actions
521     files. It is strongly recommended to become familiar with the new actions
522     concept below, before modifying these files. Locally defined rules should
523     go into user.action.
524    
525   * Some installers may not automatically start Privoxy after installation.
526    
527 -------------------------------------------------------------------------------
528
529 4. Quickstart to Using Privoxy
530
531   * If upgrading, from versions before 2.9.16, please back up any configuration
532     files. See the Note to Upgraders Section.
533    
534   * Install Privoxy. See the Installation Section below for platform specific
535     information.
536    
537   * Advanced users and those who want to offer Privoxy service to more than
538     just their local machine should check the main config file, especially the 
539     security-relevant options. These are off by default.
540    
541   * Start Privoxy, if the installation program has not done this already (may
542     vary according to platform). See the section Starting Privoxy.
543    
544   * Set your browser to use Privoxy as HTTP and HTTPS (SSL) proxy by setting
545     the proxy configuration for address of 127.0.0.1 and port 8118. (Junkbuster
546     and earlier versions of Privoxy used port 8000.) See the section Starting
547     Privoxy below for more details on this.
548    
549   * Flush your browser's disk and memory caches, to remove any cached ad
550     images. If using Privoxy to manage cookies, you should remove any currently
551     stored cookies too.
552    
553   * A default installation should provide a reasonable starting point for most.
554     There will undoubtedly be occasions where you will want to adjust the
555     configuration, but that can be dealt with as the need arises. Little to no
556     initial configuration is required in most cases.
557    
558     See the Configuration section for more configuration options, and how to
559     customize your installation.
560    
561   * If you experience ads that slipped through, innocent images that are
562     blocked, or otherwise feel the need to fine-tune Privoxy's behaviour, take
563     a look at the actions files. As a quick start, you might find the richly
564     commented examples helpful. You can also view and edit the actions files
565     through the web-based user interface. The Appendix "Anatomy of an Action"
566     has hints how to debug actions that "misbehave".
567    
568   * Please see the section Contacting the Developers on how to report bugs or
569     problems with websites or to get help.
570    
571   * Now enjoy surfing with enhanced comfort and privacy!
572    
573 -------------------------------------------------------------------------------
574
575 4.1. Quickstart to Ad Blocking
576
577 Ad blocking is but one of Privoxy's array of features. Many of these features
578 are for the technically minded advanced user. But, ad and banner blocking is
579 surely common ground for everybody.
580
581 This section will provide a quick summary of ad blocking so you can get up to
582 speed quickly without having to read the more extensive information provided
583 below, though this is highly recommended.
584
585 First a bit of a warning ... blocking ads is much like blocking SPAM: the more
586 aggressive you are about it, the more likely you are to block things that were
587 not intended. So there is a trade off here. If you want extreme ad free
588 browsing, be prepared to deal with more "problem" sites, and to spend more time
589 adjusting the configuration to solve these unintended consequences. In short,
590 there is not an easy way to eliminate all ads. Either take the easy way and
591 settle for most ads blocked with the default configuration, or jump in and
592 tweak it for your personal surfing habits and preferences.
593
594 Secondly, a brief explanation of Privoxy's "actions". "Actions" in this
595 context, are the directives we use to tell Privoxy to perform some task
596 relating to HTTP transactions (i.e. web browsing). We tell Privoxy to take some
597 "action". Each action has a unique name and function. While there are many
598 potential actions in Privoxy's arsenal, only a few are used for ad blocking. 
599 Actions, and action configuration files, are explained in depth below.
600
601 Actions are specified in Privoxy's configuration, followed by one or more URLs
602 to which the action should apply. URLs can actually be URL type patterns that
603 use wildcards so they can apply potentially to a range of similar URLs. The
604 actions, together with the URL patterns are called a section.
605
606 When you connect to a website, the full URL will either match one or more of
607 the sections as defined in Privoxy's configuration, or not. If so, then Privoxy
608 will perform the respective actions. If not, then nothing special happens.
609 Furthermore, web pages may contain embedded, secondary URLs that your web
610 browser will use to load additional components of the page, as it parses the
611 original page's HTML content. An ad image for instance, is just an URL embedded
612 in the page somewhere. The image itself may be on the same server, or a server
613 somewhere else on the Internet. Complex web pages will have many such embedded
614 URLs.
615
616 The actions we need to know about for ad blocking are: block, handle-as-image,
617 and set-image-blocker:
618
619   * block - this action stops any contact between your browser and any URL
620     patterns that match this action's configuration. It can be used for
621     blocking ads, but also anything that is determined to be unwanted. By
622     itself, it simply stops any communication with the remote server and sends
623     Privoxy's own built-in BLOCKED page instead to let you now what has
624     happened.
625    
626   * handle-as-image - tells Privoxy to treat this URL as an image. Privoxy's
627     default configuration already does this for all common image types (e.g.
628     GIF), but there are many situations where this is not so easy to determine.
629     So we'll force it in these cases. This is particularly important for ad
630     blocking, since only if we know that it's an image of some kind, can we
631     replace it with an image of our choosing, instead of the Privoxy BLOCKED
632     page (which would only result in a "broken image" icon). There are some
633     limitations to this though. For instance, you can't just brute-force an
634     image substitution for an entire HTML page in most situations.
635    
636   * set-image-blocker - tells Privoxy what to display in place of an ad image
637     that has hit a block rule. For this to come into play, the URL must match a
638     block action somewhere in the configuration, and, it must also match an 
639     handle-as-image action.
640    
641     The configuration options on what to display instead of the ad are:
642    
643        pattern - a checkerboard pattern, so that an ad replacement is obvious. 
644     This is the default.                                                       
645    
646        blank - A very small empty GIF image is displayed. This is the so-called
647     "invisible" configuration option.                                          
648    
649        http://<URL> - A redirect to any image anywhere of the user's choosing  
650     (advanced usage).                                                          
651    
652 The quickest way to adjust any of these settings is with your browser through
653 the special Privoxy editor at http://config.privoxy.org/show-status (shortcut: 
654 http://p.p/show-status). This is an internal page, and does not require
655 Internet access. Select the appropriate "actions" file, and click "Edit". It is
656 best to put personal or local preferences in user.action since this is not
657 meant to be overwritten during upgrades, and will over-ride the settings in
658 other files. Here you can insert new "actions", and URLs for ad blocking or
659 other purposes, and make other adjustments to the configuration. Privoxy will
660 detect these changes automatically.
661
662 A quick and simple step by step example:
663
664   * Right click on the ad image to be blocked, then select "Copy Link Location"
665     from the pop-up menu.
666    
667   * Set your browser to http://config.privoxy.org/show-status
668    
669   * Find user.action in the top section, and click on "Edit":
670    
671     Figure 1. Actions Files in Use
672    
673     [files-in-u]
674    
675   * You should have a section with only block listed under "Actions:". If not,
676     click a "Insert new section below" button, and in the new section that just
677     appeared, click the Edit button right under the word "Actions:". This will
678     bring up a list of all actions. Find block near the top, and click in the
679     "Enabled" column, then "Submit" just below the list.
680    
681   * Now, in the block actions section, click the "Add" button, and paste the
682     URL the browser got from "Copy Link Location". Remove the http:// at the
683     beginning of the URL. Then, click "Submit" (or "OK" if in a pop-up window).
684    
685   * Now go back to the original page, and press SHIFT-Reload (or flush all
686     browser caches). The image should be gone now.
687    
688 This is a very crude and simple example. There might be good reasons to use a
689 wildcard pattern match to include potentially similar images from the same
690 site. For a more extensive explanation of "patterns", and the entire actions
691 concept, see the Actions section.
692
693 For advanced users who want to hand edit their config files, you might want to
694 now go to the Actions Files Tutorial. The ideas explained therein also apply to
695 the web-based editor.
696
697 -------------------------------------------------------------------------------
698
699 5. Starting Privoxy
700
701 Before launching Privoxy for the first time, you will want to configure your
702 browser(s) to use Privoxy as a HTTP and HTTPS proxy. The default is 127.0.0.1
703 (or localhost) for the proxy address, and port 8118 (earlier versions used port
704 8000). This is the one configuration step that must be done!
705
706 Please note that Privoxy can only proxy HTTP and HTTPS traffic. It will not
707 work with FTP or other protocols.
708
709 Figure 2. Proxy Configuration (Mozilla)
710
711 [proxy_setu]
712
713 With Netscape (and Mozilla), this can be set under:
714
715  Edit
716    |_   
717          Preferences
718                 |_       
719                         Advanced
720                               |_     
721                                     Proxies
722                                          |_       
723                                                 HTTP Proxy
724
725 For Internet Explorer:
726
727  Tools
728      |_   
729          Internet Properties
730                             |_       
731                                       Connections
732                                                |_     
733                                                             LAN Settings
734
735 Then, check "Use Proxy" and fill in the appropriate info (Address: 127.0.0.1,
736 Port: 8118). Include HTTPS (SSL), if you want HTTPS proxy support too.
737
738 After doing this, flush your browser's disk and memory caches to force a
739 re-reading of all pages and to get rid of any ads that may be cached. You are
740 now ready to start enjoying the benefits of using Privoxy!
741
742 Privoxy is typically started by specifying the main configuration file to be
743 used on the command line. If no configuration file is specified on the command
744 line, Privoxy will look for a file named config in the current directory.
745 Except on Win32 where it will try config.txt.
746
747 -------------------------------------------------------------------------------
748
749 5.1. Red Hat and Conectiva
750
751 We use a script. Note that Red Hat does not start Privoxy upon booting per
752 default. It will use the file /etc/privoxy/config as its main configuration
753 file.
754
755  # /etc/rc.d/init.d/privoxy start                                              
756
757 -------------------------------------------------------------------------------
758
759 5.2. Debian
760
761 We use a script. Note that Debian starts Privoxy upon booting per default. It
762 will use the file /etc/privoxy/config as its main configuration file.
763
764  # /etc/init.d/privoxy start                                                   
765
766 -------------------------------------------------------------------------------
767
768 5.3. SuSE
769
770 We use a script. It will use the file /etc/privoxy/config as its main
771 configuration file. Note that SuSE starts Privoxy upon booting your PC.
772
773  # rcprivoxy start                                                             
774
775 -------------------------------------------------------------------------------
776
777 5.4. Windows
778
779 Click on the Privoxy Icon to start Privoxy. If no configuration file is
780 specified on the command line, Privoxy will look for a file named config.txt.
781 Note that Windows will automatically start Privoxy upon booting you PC.
782
783 -------------------------------------------------------------------------------
784
785 5.5. Solaris, NetBSD, FreeBSD, HP-UX and others
786
787 Example Unix startup command:
788
789  # /usr/sbin/privoxy /etc/privoxy/config                                       
790
791 -------------------------------------------------------------------------------
792
793 5.6. OS/2
794
795 During installation, Privoxy is configured to start automatically when the
796 system restarts. You can start it manually by double-clicking on the Privoxy
797 icon in the Privoxy folder.
798
799 -------------------------------------------------------------------------------
800
801 5.7. Mac OSX
802
803 During installation, Privoxy is configured to start automatically when the
804 system restarts. To start Privoxy by hand, double-click on the
805 StartPrivoxy.command icon in the /Library/Privoxy folder. Or, type this command
806 in the Terminal:
807
808   /Library/Privoxy/StartPrivoxy.command                                        
809                                                                                
810
811 You will be prompted for the administrator password.
812
813 -------------------------------------------------------------------------------
814
815 5.8. AmigaOS
816
817 Start Privoxy (with RUN <>NIL:) in your startnet script (AmiTCP), in s:
818 user-startup (RoadShow), as startup program in your startup script (Genesis),
819 or as startup action (Miami and MiamiDx). Privoxy will automatically quit when
820 you quit your TCP/IP stack (just ignore the harmless warning your TCP/IP stack
821 may display that Privoxy is still running).
822
823 -------------------------------------------------------------------------------
824
825 5.9. Gentoo
826
827 A script is again used. It will use the file /etc/privoxy/config as its main
828 configuration file.
829
830  /etc/init.d/privoxy start                                                     
831                                                                                
832
833 Note that Privoxy is not automatically started at boot time by default. You can
834 change this with the rc-update command.
835
836  rc-update add privoxy default                                                 
837                                                                                
838
839 -------------------------------------------------------------------------------
840
841 5.10. Command Line Options
842
843 Privoxy may be invoked with the following command-line options:
844
845   * --version
846    
847     Print version info and exit. Unix only.
848    
849   * --help
850    
851     Print short usage info and exit. Unix only.
852    
853   * --no-daemon
854    
855     Don't become a daemon, i.e. don't fork and become process group leader, and
856     don't detach from controlling tty. Unix only.
857    
858   * --pidfile FILE
859    
860     On startup, write the process ID to FILE. Delete the FILE on exit. Failure
861     to create or delete the FILE is non-fatal. If no FILE option is given, no
862     PID file will be used. Unix only.
863    
864   * --user USER[.GROUP]
865    
866     After (optionally) writing the PID file, assume the user ID of USER, and if
867     included the GID of GROUP. Exit if the privileges are not sufficient to do
868     so. Unix only.
869    
870   * --chroot
871    
872     Before changing to the user ID given in the --user option, chroot to that
873     user's home directory, i.e. make the kernel pretend to the Privoxy process
874     that the directory tree starts there. If set up carefully, this can limit
875     the impact of possible vulnerabilities in Privoxy to the files contained in
876     that hierarchy. Unix only.
877    
878   * configfile
879    
880     If no configfile is included on the command line, Privoxy will look for a
881     file named "config" in the current directory (except on Win32 where it will
882     look for "config.txt" instead). Specify full path to avoid confusion. If no
883     config file is found, Privoxy will fail to start.
884    
885 -------------------------------------------------------------------------------
886
887 6. Privoxy Configuration
888
889 All Privoxy configuration is stored in text files. These files can be edited
890 with a text editor. Many important aspects of Privoxy can also be controlled
891 easily with a web browser.
892
893 -------------------------------------------------------------------------------
894
895 6.1. Controlling Privoxy with Your Web Browser
896
897 Privoxy's user interface can be reached through the special URL http://
898 config.privoxy.org/ (shortcut: http://p.p/), which is a built-in page and works
899 without Internet access. You will see the following section: 
900
901      Privoxy Menu                                                              
902         ?  View & change the current configuration                             
903         ?  View the source code version numbers                                
904         ?  View the request headers.                                           
905         ?  Look up which actions apply to a URL and why                        
906         ?  Toggle Privoxy on or off                                            
907         ?  Documentation                                                       
908                                                                                
909
910 This should be self-explanatory. Note the first item leads to an editor for the
911 actions files, which is where the ad, banner, cookie, and URL blocking magic is
912 configured as well as other advanced features of Privoxy. This is an easy way
913 to adjust various aspects of Privoxy configuration. The actions file, and other
914 configuration files, are explained in detail below.
915
916 "Toggle Privoxy On or Off" is handy for sites that might have problems with
917 your current actions and filters. You can in fact use it as a test to see
918 whether it is Privoxy causing the problem or not. Privoxy continues to run as a
919 proxy in this case, but all manipulation is disabled, i.e. Privoxy acts like a
920 normal forwarding proxy. There is even a toggle Bookmarklet offered, so that
921 you can toggle Privoxy with one click from your browser.
922
923 -------------------------------------------------------------------------------
924
925 6.2. Configuration Files Overview
926
927 For Unix, *BSD and Linux, all configuration files are located in /etc/privoxy/
928 by default. For MS Windows, OS/2, and AmigaOS these are all in the same
929 directory as the Privoxy executable.
930
931 The installed defaults provide a reasonable starting point, though some
932 settings may be aggressive by some standards. For the time being, the principle
933 configuration files are:
934
935   * The main configuration file is named config on Linux, Unix, BSD, OS/2, and
936     AmigaOS and config.txt on Windows. This is a required file.
937    
938   * default.action (the main actions file) is used to define which "actions"
939     relating to banner-blocking, images, pop-ups, content modification, cookie
940     handling etc should be applied by default. It also defines many exceptions
941     (both positive and negative) from this default set of actions that enable
942     Privoxy to selectively eliminate the junk, and only the junk, on as many
943     websites as possible.
944    
945     Multiple actions files may be defined in config. These are processed in the
946     order they are defined. Local customizations and locally preferred
947     exceptions to the default policies as defined in default.action (which you
948     will most probably want to define sooner or later) are probably best
949     applied in user.action, where you can preserve them across upgrades.
950     standard.action is for Privoxy's internal use.
951    
952     There is also a web based editor that can be accessed from http://
953     config.privoxy.org/show-status (Shortcut: http://p.p/show-status) for the
954     various actions files.
955    
956   * default.filter (the filter file) can be used to re-write the raw page
957     content, including viewable text as well as embedded HTML and JavaScript,
958     and whatever else lurks on any given web page. The filtering jobs are only
959     pre-defined here; whether to apply them or not is up to the actions files.
960    
961 All files use the "#" character to denote a comment (the rest of the line will
962 be ignored) and understand line continuation through placing a backslash ("\")
963 as the very last character in a line. If the # is preceded by a backslash, it
964 looses its special function. Placing a # in front of an otherwise valid
965 configuration line to prevent it from being interpreted is called "commenting
966 out" that line.
967
968 The actions files and default.filter can use Perl style regular expressions for
969 maximum flexibility.
970
971 After making any changes, there is no need to restart Privoxy in order for the
972 changes to take effect. Privoxy detects such changes automatically. Note,
973 however, that it may take one or two additional requests for the change to take
974 effect. When changing the listening address of Privoxy, these "wake up"
975 requests must obviously be sent to the old listening address.
976
977 -------------------------------------------------------------------------------
978
979 7. The Main Configuration File
980
981 Again, the main configuration file is named config on Linux/Unix/BSD and OS/2,
982 and config.txt on Windows. Configuration lines consist of an initial keyword
983 followed by a list of values, all separated by whitespace (any number of spaces
984 or tabs). For example:
985
986   confdir /etc/privoxy
987
988 Assigns the value /etc/privoxy to the option confdir and thus indicates that
989 the configuration directory is named "/etc/privoxy/".
990
991 All options in the config file except for confdir and logdir are optional.
992 Watch out in the below description for what happens if you leave them unset.
993
994 The main config file controls all aspects of Privoxy's operation that are not
995 location dependent (i.e. they apply universally, no matter where you may be
996 surfing).
997
998 -------------------------------------------------------------------------------
999
1000 7.1. Configuration and Log File Locations
1001
1002 Privoxy can (and normally does) use a number of other files for additional
1003 configuration, help and logging. This section of the configuration file tells
1004 Privoxy where to find those other files.
1005
1006 The user running Privoxy, must have read permission for all configuration
1007 files, and write permission to any files that would be modified, such as log
1008 files and actions files.
1009
1010 -------------------------------------------------------------------------------
1011
1012 7.1.1. confdir
1013
1014 Specifies:
1015    
1016     The directory where the other configuration files are located
1017    
1018 Type of value:
1019    
1020     Path name
1021    
1022 Default value:
1023    
1024     /etc/privoxy (Unix) or Privoxy installation dir (Windows)
1025    
1026 Effect if unset:
1027    
1028     Mandatory
1029    
1030 Notes:
1031    
1032     No trailing "/", please
1033    
1034     When development goes modular and multi-user, the blocker, filter, and
1035     per-user config will be stored in subdirectories of "confdir". For now, the
1036     configuration directory structure is flat, except for confdir/templates,
1037     where the HTML templates for CGI output reside (e.g. Privoxy's 404 error
1038     page).
1039    
1040 -------------------------------------------------------------------------------
1041
1042 7.1.2. logdir
1043
1044 Specifies:
1045    
1046     The directory where all logging takes place (i.e. where logfile and jarfile
1047     are located)
1048    
1049 Type of value:
1050    
1051     Path name
1052    
1053 Default value:
1054    
1055     /var/log/privoxy (Unix) or Privoxy installation dir (Windows)
1056    
1057 Effect if unset:
1058    
1059     Mandatory
1060    
1061 Notes:
1062    
1063     No trailing "/", please
1064    
1065 -------------------------------------------------------------------------------
1066
1067 7.1.3. actionsfile
1068
1069 Specifies:
1070    
1071     The actions file(s) to use
1072    
1073 Type of value:
1074    
1075     File name, relative to confdir, without the .action suffix
1076    
1077 Default values:
1078    
1079       standard     # Internal purposes, no editing recommended
1080                                                               
1081       default      # Main actions file                        
1082                                                               
1083       user         # User customizations                      
1084    
1085 Effect if unset:
1086    
1087     No actions are taken at all. Simple neutral proxying.
1088    
1089 Notes:
1090    
1091     Multiple actionsfile lines are permitted, and are in fact recommended!
1092    
1093     The default values include standard.action, which is used for internal
1094     purposes and should be loaded, default.action, which is the "main" actions
1095     file maintained by the developers, and user.action, where you can make your
1096     personal additions.
1097    
1098     Actions files are where all the per site and per URL configuration is done
1099     for ad blocking, cookie management, privacy considerations, etc. There is
1100     no point in using Privoxy without at least one actions file.
1101    
1102 -------------------------------------------------------------------------------
1103
1104 7.1.4. filterfile
1105
1106 Specifies:
1107    
1108     The filter file to use
1109    
1110 Type of value:
1111    
1112     File name, relative to confdir
1113    
1114 Default value:
1115    
1116     default.filter (Unix) or default.filter.txt (Windows)
1117    
1118 Effect if unset:
1119    
1120     No textual content filtering takes place, i.e. all +filter{name} actions in
1121     the actions files are turned neutral.
1122    
1123 Notes:
1124    
1125     The filter file contains content modification rules that use regular
1126     expressions. These rules permit powerful changes on the content of Web
1127     pages, e.g., you could disable your favorite JavaScript annoyances,
1128     re-write the actual displayed text, or just have some fun replacing
1129     "Microsoft" with "MicroSuck" wherever it appears on a Web page.
1130    
1131     The +filter{name} actions rely on the relevant filter (name) to be defined
1132     in the filter file!
1133    
1134     A pre-defined filter file called default.filter that contains a bunch of
1135     handy filters for common problems is included in the distribution. See the
1136     section on the filter action for a list.
1137    
1138 -------------------------------------------------------------------------------
1139
1140 7.1.5. logfile
1141
1142 Specifies:
1143    
1144     The log file to use
1145    
1146 Type of value:
1147    
1148     File name, relative to logdir
1149    
1150 Default value:
1151    
1152     logfile (Unix) or privoxy.log (Windows)
1153    
1154 Effect if unset:
1155    
1156     No log file is used, all log messages go to the console (STDERR).
1157    
1158 Notes:
1159    
1160     The logfile is where all logging and error messages are written. The level
1161     of detail and number of messages are set with the debug option (see below).
1162     The logfile can be useful for tracking down a problem with Privoxy (e.g.,
1163     it's not blocking an ad you think it should block) but in most cases you
1164     probably will never look at it.
1165    
1166     Your logfile will grow indefinitely, and you will probably want to
1167     periodically remove it. On Unix systems, you can do this with a cron job
1168     (see "man cron"). For Red Hat, a logrotate script has been included.
1169    
1170     On SuSE Linux systems, you can place a line like "/var/log/privoxy.* +1024k
1171     644 nobody.nogroup" in /etc/logfiles, with the effect that cron.daily will
1172     automatically archive, gzip, and empty the log, when it exceeds 1M size.
1173    
1174     Any log files must be writable by whatever user Privoxy is being run as
1175     (default on UNIX, user id is "privoxy").
1176    
1177 -------------------------------------------------------------------------------
1178
1179 7.1.6. jarfile
1180
1181 Specifies:
1182    
1183     The file to store intercepted cookies in
1184    
1185 Type of value:
1186    
1187     File name, relative to logdir
1188    
1189 Default value:
1190    
1191     jarfile (Unix) or privoxy.jar (Windows)
1192    
1193 Effect if unset:
1194    
1195     Intercepted cookies are not stored at all.
1196    
1197 Notes:
1198    
1199     The jarfile may grow to ridiculous sizes over time.
1200    
1201 -------------------------------------------------------------------------------
1202
1203 7.1.7. trustfile
1204
1205 Specifies:
1206    
1207     The trust file to use
1208    
1209 Type of value:
1210    
1211     File name, relative to confdir
1212    
1213 Default value:
1214    
1215     Unset (commented out). When activated: trust (Unix) or trust.txt (Windows)
1216    
1217 Effect if unset:
1218    
1219     The entire trust mechanism is turned off.
1220    
1221 Notes:
1222    
1223     The trust mechanism is an experimental feature for building white-lists and
1224     should be used with care. It is NOT recommended for the casual user.
1225    
1226     If you specify a trust file, Privoxy will only allow access to sites that
1227     are specified in the trustfile. Sites can be listed in one of two ways:
1228    
1229     Prepending a ~ character limits access to this site only (and any sub-paths
1230     within this site), e.g. ~www.example.com.
1231    
1232     Or, you can designate sites as trusted referrers, by prepending the name
1233     with a + character. The effect is that access to untrusted sites will be
1234     granted -- but only if a link from this trusted referrer was used. The link
1235     target will then be added to the "trustfile" so that future, direct
1236     accesses will be granted. Sites added via this mechanism do not become
1237     trusted referrers themselves (i.e. they are added with a ~ designation).
1238    
1239     If you use the + operator in the trust file, it may grow considerably over
1240     time.
1241    
1242     It is recommended that Privoxy be compiled with the --disable-force,
1243     --disable-toggle and --disable-editor options, if this feature is to be
1244     used.
1245    
1246     Possible applications include limiting Internet access for children.
1247    
1248 -------------------------------------------------------------------------------
1249
1250 7.2. Local Set-up Documentation
1251
1252 If you intend to operate Privoxy for more users than just yourself, it might be
1253 a good idea to let them know how to reach you, what you block and why you do
1254 that, your policies, etc.
1255
1256 -------------------------------------------------------------------------------
1257
1258 7.2.1. user-manual
1259
1260 Specifies:
1261    
1262     Location of the Privoxy User Manual.
1263    
1264 Type of value:
1265    
1266     A fully qualified URI
1267    
1268 Default value:
1269    
1270     Unset
1271    
1272 Effect if unset:
1273    
1274     http://www.privoxy.org/version/user-manual/ will be used, where version is
1275     the Privoxy version.
1276    
1277 Notes:
1278    
1279     The User Manual URI is used for help links from some of the internal CGI
1280     pages. The manual itself is normally packaged with the binary
1281     distributions, so you probably want to set this to a locally installed
1282     copy. For multi-user setups, you could provide a copy on a local webserver
1283     for all your users and use the corresponding URL here.
1284    
1285     Examples:
1286    
1287     Unix, in local filesystem:
1288    
1289       user-manual  file:///usr/share/doc/privoxy-3.0.1/user-manual/    
1290    
1291     Windows, in local filesystem, must use forward slash notation:
1292    
1293       user-manual  file:/c:/some-dir/privoxy-3.0.1/user-manual/        
1294    
1295     Windows, UNC notation (with forward slashes):
1296    
1297       user-manual  file://///some-server/some-path/privoxy-3.0.1/user-manual/
1298    
1299     Any platform, on local webserver (called "local-webserver"):
1300    
1301       user-manual  http://local-webserver/privoxy-user-manual/         
1302    
1303     +-----------------------------------------------------------------+
1304     |                             Warning                             |
1305     |-----------------------------------------------------------------|
1306     |If set, this option should be the first option in the config     |
1307     |file, because it is used while the config file is being read.    |
1308     +-----------------------------------------------------------------+
1309
1310 -------------------------------------------------------------------------------
1311
1312 7.2.2. trust-info-url
1313
1314 Specifies:
1315    
1316     A URL to be displayed in the error page that users will see if access to an
1317     untrusted page is denied.
1318    
1319 Type of value:
1320    
1321     URL
1322    
1323 Default value:
1324    
1325     Two example URL are provided
1326    
1327 Effect if unset:
1328    
1329     No links are displayed on the "untrusted" error page.
1330    
1331 Notes:
1332    
1333     The value of this option only matters if the experimental trust mechanism
1334     has been activated. (See trustfile above.)
1335    
1336     If you use the trust mechanism, it is a good idea to write up some on-line
1337     documentation about your trust policy and to specify the URL(s) here. Use
1338     multiple times for multiple URLs.
1339    
1340     The URL(s) should be added to the trustfile as well, so users don't end up
1341     locked out from the information on why they were locked out in the first
1342     place!
1343    
1344 -------------------------------------------------------------------------------
1345
1346 7.2.3. admin-address
1347
1348 Specifies:
1349    
1350     An email address to reach the proxy administrator.
1351    
1352 Type of value:
1353    
1354     Email address
1355    
1356 Default value:
1357    
1358     Unset
1359    
1360 Effect if unset:
1361    
1362     No email address is displayed on error pages and the CGI user interface.
1363    
1364 Notes:
1365    
1366     If both admin-address and proxy-info-url are unset, the whole "Local
1367     Privoxy Support" box on all generated pages will not be shown.
1368    
1369 -------------------------------------------------------------------------------
1370
1371 7.2.4. proxy-info-url
1372
1373 Specifies:
1374    
1375     A URL to documentation about the local Privoxy setup, configuration or
1376     policies.
1377    
1378 Type of value:
1379    
1380     URL
1381    
1382 Default value:
1383    
1384     Unset
1385    
1386 Effect if unset:
1387    
1388     No link to local documentation is displayed on error pages and the CGI user
1389     interface.
1390    
1391 Notes:
1392    
1393     If both admin-address and proxy-info-url are unset, the whole "Local
1394     Privoxy Support" box on all generated pages will not be shown.
1395    
1396     This URL shouldn't be blocked ;-)
1397    
1398 -------------------------------------------------------------------------------
1399
1400 7.3. Debugging
1401
1402 These options are mainly useful when tracing a problem. Note that you might
1403 also want to invoke Privoxy with the --no-daemon command line option when
1404 debugging.
1405
1406 -------------------------------------------------------------------------------
1407
1408 7.3.1. debug
1409
1410 Specifies:
1411    
1412     Key values that determine what information gets logged to the logfile.
1413    
1414 Type of value:
1415    
1416     Integer values
1417    
1418 Default value:
1419    
1420     12289 (i.e.: URLs plus informational and warning messages)
1421    
1422 Effect if unset:
1423    
1424     Nothing gets logged.
1425    
1426 Notes:
1427    
1428     The available debug levels are:
1429    
1430       debug         1 # show each GET/POST/CONNECT request             
1431       debug         2 # show each connection status                    
1432       debug         4 # show I/O status                                
1433       debug         8 # show header parsing                            
1434       debug        16 # log all data into the logfile                  
1435       debug        32 # debug force feature                            
1436       debug        64 # debug regular expression filter                
1437       debug       128 # debug fast redirects                           
1438       debug       256 # debug GIF de-animation                         
1439       debug       512 # Common Log Format                              
1440       debug      1024 # debug kill pop-ups                             
1441       debug      2048 # CGI user interface                             
1442       debug      4096 # Startup banner and warnings.                   
1443       debug      8192 # Non-fatal errors                               
1444    
1445     To select multiple debug levels, you can either add them or use multiple
1446     debug lines.
1447    
1448     A debug level of 1 is informative because it will show you each request as
1449     it happens. 1, 4096 and 8192 are highly recommended so that you will notice
1450     when things go wrong. The other levels are probably only of interest if you
1451     are hunting down a specific problem. They can produce a hell of an output
1452     (especially 16).
1453    
1454     The reporting of fatal errors (i.e. ones which crash Privoxy) is always on
1455     and cannot be disabled.
1456    
1457     If you want to use CLF (Common Log Format), you should set "debug 512" ONLY
1458     and not enable anything else.
1459    
1460 -------------------------------------------------------------------------------
1461
1462 7.3.2. single-threaded
1463
1464 Specifies:
1465    
1466     Whether to run only one server thread
1467    
1468 Type of value:
1469    
1470     None
1471    
1472 Default value:
1473    
1474     Unset
1475    
1476 Effect if unset:
1477    
1478     Multi-threaded (or, where unavailable: forked) operation, i.e. the ability
1479     to serve multiple requests simultaneously.
1480    
1481 Notes:
1482    
1483     This option is only there for debug purposes and you should never need to
1484     use it. It will drastically reduce performance.
1485    
1486 -------------------------------------------------------------------------------
1487
1488 7.4. Access Control and Security
1489
1490 This section of the config file controls the security-relevant aspects of
1491 Privoxy's configuration.
1492
1493 -------------------------------------------------------------------------------
1494
1495 7.4.1. listen-address
1496
1497 Specifies:
1498    
1499     The IP address and TCP port on which Privoxy will listen for client
1500     requests.
1501    
1502 Type of value:
1503    
1504     [IP-Address]:Port
1505    
1506 Default value:
1507    
1508     127.0.0.1:8118
1509    
1510 Effect if unset:
1511    
1512     Bind to 127.0.0.1 (localhost), port 8118. This is suitable and recommended
1513     for home users who run Privoxy on the same machine as their browser.
1514    
1515 Notes:
1516    
1517     You will need to configure your browser(s) to this proxy address and port.
1518    
1519     If you already have another service running on port 8118, or if you want to
1520     serve requests from other machines (e.g. on your local network) as well,
1521     you will need to override the default.
1522    
1523     If you leave out the IP address, Privoxy will bind to all interfaces
1524     (addresses) on your machine and may become reachable from the Internet. In
1525     that case, consider using access control lists (ACL's, see below), and/or a
1526     firewall.
1527    
1528     If you open Privoxy to untrusted users, you will also want to turn off the 
1529     enable-edit-actions and enable-remote-toggle options!
1530    
1531 Example:
1532    
1533     Suppose you are running Privoxy on a machine which has the address
1534     192.168.0.1 on your local private network (192.168.0.0) and has another
1535     outside connection with a different address. You want it to serve requests
1536     from inside only:
1537    
1538       listen-address  192.168.0.1:8118                                 
1539    
1540 -------------------------------------------------------------------------------
1541
1542 7.4.2. toggle
1543
1544 Specifies:
1545    
1546     Initial state of "toggle" status
1547    
1548 Type of value:
1549    
1550     1 or 0
1551    
1552 Default value:
1553    
1554     1
1555    
1556 Effect if unset:
1557    
1558     Act as if toggled on
1559    
1560 Notes:
1561    
1562     If set to 0, Privoxy will start in "toggled off" mode, i.e. behave like a
1563     normal, content-neutral proxy where all ad blocking, filtering, etc are
1564     disabled. See enable-remote-toggle below. This is not really useful
1565     anymore, since toggling is much easier via the web interface than via
1566     editing the conf file.
1567    
1568     The windows version will only display the toggle icon in the system tray if
1569     this option is present.
1570    
1571 -------------------------------------------------------------------------------
1572
1573 7.4.3. enable-remote-toggle
1574
1575 Specifies:
1576    
1577     Whether or not the web-based toggle feature may be used
1578    
1579 Type of value:
1580    
1581     0 or 1
1582    
1583 Default value:
1584    
1585     1
1586    
1587 Effect if unset:
1588    
1589     The web-based toggle feature is disabled.
1590    
1591 Notes:
1592    
1593     When toggled off, Privoxy acts like a normal, content-neutral proxy, i.e.
1594     it acts as if none of the actions applied to any URL.
1595    
1596     For the time being, access to the toggle feature can not be controlled
1597     separately by "ACLs" or HTTP authentication, so that everybody who can
1598     access Privoxy (see "ACLs" and listen-address above) can toggle it for all
1599     users. So this option is not recommended for multi-user environments with
1600     untrusted users.
1601    
1602     Note that you must have compiled Privoxy with support for this feature,
1603     otherwise this option has no effect.
1604    
1605 -------------------------------------------------------------------------------
1606
1607 7.4.4. enable-edit-actions
1608
1609 Specifies:
1610    
1611     Whether or not the web-based actions file editor may be used
1612    
1613 Type of value:
1614    
1615     0 or 1
1616    
1617 Default value:
1618    
1619     1
1620    
1621 Effect if unset:
1622    
1623     The web-based actions file editor is disabled.
1624    
1625 Notes:
1626    
1627     For the time being, access to the editor can not be controlled separately
1628     by "ACLs" or HTTP authentication, so that everybody who can access Privoxy
1629     (see "ACLs" and listen-address above) can modify its configuration for all
1630     users. So this option is not recommended for multi-user environments with
1631     untrusted users.
1632    
1633     Note that you must have compiled Privoxy with support for this feature,
1634     otherwise this option has no effect.
1635    
1636 -------------------------------------------------------------------------------
1637
1638 7.4.5. ACLs: permit-access and deny-access
1639
1640 Specifies:
1641    
1642     Who can access what.
1643    
1644 Type of value:
1645    
1646     src_addr[/src_masklen] [dst_addr[/dst_masklen]]
1647    
1648     Where src_addr and dst_addr are IP addresses in dotted decimal notation or
1649     valid DNS names, and src_masklen and dst_masklen are subnet masks in CIDR
1650     notation, i.e. integer values from 2 to 30 representing the length (in
1651     bits) of the network address. The masks and the whole destination part are
1652     optional.
1653    
1654 Default value:
1655    
1656     Unset
1657    
1658 Effect if unset:
1659    
1660     Don't restrict access further than implied by listen-address
1661    
1662 Notes:
1663    
1664     Access controls are included at the request of ISPs and systems
1665     administrators, and are not usually needed by individual users. For a
1666     typical home user, it will normally suffice to ensure that Privoxy only
1667     listens on the localhost (127.0.0.1) or internal (home) network address by
1668     means of the listen-address option.
1669    
1670     Please see the warnings in the FAQ that this proxy is not intended to be a
1671     substitute for a firewall or to encourage anyone to defer addressing basic
1672     security weaknesses.
1673    
1674     Multiple ACL lines are OK. If any ACLs are specified, then the Privoxy
1675     talks only to IP addresses that match at least one permit-access line and
1676     don't match any subsequent deny-access line. In other words, the last match
1677     wins, with the default being deny-access.
1678    
1679     If Privoxy is using a forwarder (see forward below) for a particular
1680     destination URL, the dst_addr that is examined is the address of the
1681     forwarder and NOT the address of the ultimate target. This is necessary
1682     because it may be impossible for the local Privoxy to determine the IP
1683     address of the ultimate target (that's often what gateways are used for).
1684    
1685     You should prefer using IP addresses over DNS names, because the address
1686     lookups take time. All DNS names must resolve! You can not use domain
1687     patterns like "*.org" or partial domain names. If a DNS name resolves to
1688     multiple IP addresses, only the first one is used.
1689    
1690     Denying access to particular sites by ACL may have undesired side effects
1691     if the site in question is hosted on a machine which also hosts other
1692     sites.
1693    
1694 Examples:
1695    
1696     Explicitly define the default behavior if no ACL and listen-address are
1697     set: "localhost" is OK. The absence of a dst_addr implies that all
1698     destination addresses are OK:
1699    
1700       permit-access  localhost                                         
1701    
1702     Allow any host on the same class C subnet as www.privoxy.org access to
1703     nothing but www.example.com:
1704    
1705       permit-access  www.privoxy.org/24 www.example.com/32             
1706    
1707     Allow access from any host on the 26-bit subnet 192.168.45.64 to anywhere,
1708     with the exception that 192.168.45.73 may not access
1709     www.dirty-stuff.example.com:
1710    
1711       permit-access  192.168.45.64/26                                  
1712       deny-access    192.168.45.73    www.dirty-stuff.example.com      
1713    
1714 -------------------------------------------------------------------------------
1715
1716 7.4.6. buffer-limit
1717
1718 Specifies:
1719    
1720     Maximum size of the buffer for content filtering.
1721    
1722 Type of value:
1723    
1724     Size in Kbytes
1725    
1726 Default value:
1727    
1728     4096
1729    
1730 Effect if unset:
1731    
1732     Use a 4MB (4096 KB) limit.
1733    
1734 Notes:
1735    
1736     For content filtering, i.e. the +filter and +deanimate-gif actions, it is
1737     necessary that Privoxy buffers the entire document body. This can be
1738     potentially dangerous, since a server could just keep sending data
1739     indefinitely and wait for your RAM to exhaust -- with nasty consequences.
1740     Hence this option.
1741    
1742     When a document buffer size reaches the buffer-limit, it is flushed to the
1743     client unfiltered and no further attempt to filter the rest of the document
1744     is made. Remember that there may be multiple threads running, which might
1745     require up to buffer-limit Kbytes each, unless you have enabled
1746     "single-threaded" above.
1747    
1748 -------------------------------------------------------------------------------
1749
1750 7.5. Forwarding
1751
1752 This feature allows routing of HTTP requests through a chain of multiple
1753 proxies. It can be used to better protect privacy and confidentiality when
1754 accessing specific domains by routing requests to those domains through an
1755 anonymous public proxy (see e.g. http://www.multiproxy.org/anon_list.htm) Or to
1756 use a caching proxy to speed up browsing. Or chaining to a parent proxy may be
1757 necessary because the machine that Privoxy runs on has no direct Internet
1758 access.
1759
1760 Also specified here are SOCKS proxies. Privoxy supports the SOCKS 4 and SOCKS
1761 4A protocols.
1762
1763 -------------------------------------------------------------------------------
1764
1765 7.5.1. forward
1766
1767 Specifies:
1768    
1769     To which parent HTTP proxy specific requests should be routed.
1770    
1771 Type of value:
1772    
1773     target_pattern http_parent[:port]
1774    
1775     where target_pattern is a URL pattern that specifies to which requests
1776     (i.e. URLs) this forward rule shall apply. Use / to denote "all URLs".
1777     http_parent[:port] is the DNS name or IP address of the parent HTTP proxy
1778     through which the requests should be forwarded, optionally followed by its
1779     listening port (default: 8080). Use a single dot (.) to denote "no
1780     forwarding".
1781    
1782 Default value:
1783    
1784     Unset
1785    
1786 Effect if unset:
1787    
1788     Don't use parent HTTP proxies.
1789    
1790 Notes:
1791    
1792     If http_parent is ".", then requests are not forwarded to another HTTP
1793     proxy but are made directly to the web servers.
1794    
1795     Multiple lines are OK, they are checked in sequence, and the last match
1796     wins.
1797    
1798 Examples:
1799    
1800     Everything goes to an example anonymizing proxy, except SSL on port 443
1801     (which it doesn't handle):
1802    
1803       forward   /      anon-proxy.example.org:8080                     
1804       forward   :443   .                                               
1805    
1806     Everything goes to our example ISP's caching proxy, except for requests to
1807     that ISP's sites:
1808    
1809       forward   /                  caching-proxy.example-isp.net:8000  
1810       forward   .example-isp.net   .                                   
1811    
1812 -------------------------------------------------------------------------------
1813
1814 7.5.2. forward-socks4 and forward-socks4a
1815
1816 Specifies:
1817    
1818     Through which SOCKS proxy (and to which parent HTTP proxy) specific
1819     requests should be routed.
1820    
1821 Type of value:
1822    
1823     target_pattern socks_proxy[:port] http_parent[:port]
1824    
1825     where target_pattern is a URL pattern that specifies to which requests
1826     (i.e. URLs) this forward rule shall apply. Use / to denote "all URLs".
1827     http_parent and socks_proxy are IP addresses in dotted decimal notation or
1828     valid DNS names (http_parent may be "." to denote "no HTTP forwarding"),
1829     and the optional port parameters are TCP ports, i.e. integer values from 1
1830     to 64535
1831    
1832 Default value:
1833    
1834     Unset
1835    
1836 Effect if unset:
1837    
1838     Don't use SOCKS proxies.
1839    
1840 Notes:
1841    
1842     Multiple lines are OK, they are checked in sequence, and the last match
1843     wins.
1844    
1845     The difference between forward-socks4 and forward-socks4a is that in the
1846     SOCKS 4A protocol, the DNS resolution of the target hostname happens on the
1847     SOCKS server, while in SOCKS 4 it happens locally.
1848    
1849     If http_parent is ".", then requests are not forwarded to another HTTP
1850     proxy but are made (HTTP-wise) directly to the web servers, albeit through
1851     a SOCKS proxy.
1852    
1853 Examples:
1854    
1855     From the company example.com, direct connections are made to all "internal"
1856     domains, but everything outbound goes through their ISP's proxy by way of
1857     example.com's corporate SOCKS 4A gateway to the Internet.
1858    
1859       forward-socks4a   /              socks-gw.example.com:1080  www-cache.example-isp.net:8080 
1860       forward           .example.com   .                                                         
1861    
1862     A rule that uses a SOCKS 4 gateway for all destinations but no HTTP parent
1863     looks like this:
1864    
1865       forward-socks4   /               socks-gw.example.com:1080  .    
1866    
1867 -------------------------------------------------------------------------------
1868
1869 7.5.3. Advanced Forwarding Examples
1870
1871 If you have links to multiple ISPs that provide various special content only to
1872 their subscribers, you can configure multiple Privoxies which have connections
1873 to the respective ISPs to act as forwarders to each other, so that your users
1874 can see the internal content of all ISPs.
1875
1876 Assume that host-a has a PPP connection to isp-a.net. And host-b has a PPP
1877 connection to isp-b.net. Both run Privoxy. Their forwarding configuration can
1878 look like this:
1879
1880 host-a:
1881
1882   forward    /           .                                                     
1883   forward    .isp-b.net  host-b:8118                                           
1884
1885 host-b:
1886
1887   forward    /           .                                                     
1888   forward    .isp-a.net  host-a:8118                                           
1889
1890 Now, your users can set their browser's proxy to use either host-a or host-b
1891 and be able to browse the internal content of both isp-a and isp-b.
1892
1893 If you intend to chain Privoxy and squid locally, then chain as browser ->
1894 squid -> privoxy is the recommended way.
1895
1896 Assuming that Privoxy and squid run on the same box, your squid configuration
1897 could then look like this:
1898
1899   # Define Privoxy as parent proxy (without ICP)                               
1900   cache_peer 127.0.0.1 parent 8118 7 no-query                                  
1901                                                                                
1902   # Define ACL for protocol FTP                                                
1903   acl ftp proto FTP                                                            
1904                                                                                
1905   # Do not forward FTP requests to Privoxy                                     
1906   always_direct allow ftp                                                      
1907                                                                                
1908   # Forward all the rest to Privoxy                                            
1909   never_direct allow all                                                       
1910
1911 You would then need to change your browser's proxy settings to squid's address
1912 and port. Squid normally uses port 3128. If unsure consult http_port in
1913 squid.conf.
1914
1915 You could just as well decide to only forward requests for Windows executables
1916 through a virus-scanning parent proxy, say, on antivir.example.com, port 8010:
1917
1918   forward   /                          .                                       
1919   forward   /.*\.(exe|com|dll|zip)$    antivir.example.com:8010                
1920
1921 -------------------------------------------------------------------------------
1922
1923 7.6. Windows GUI Options
1924
1925 Privoxy has a number of options specific to the Windows GUI interface:
1926
1927 If "activity-animation" is set to 1, the Privoxy icon will animate when
1928 "Privoxy" is active. To turn off, set to 0.
1929
1930   activity-animation 1
1931    
1932
1933 If "log-messages" is set to 1, Privoxy will log messages to the console window:
1934
1935   log-messages 1
1936    
1937
1938 If "log-buffer-size" is set to 1, the size of the log buffer, i.e. the amount
1939 of memory used for the log messages displayed in the console window, will be
1940 limited to "log-max-lines" (see below).
1941
1942 Warning: Setting this to 0 will result in the buffer to grow infinitely and eat
1943 up all your memory!
1944
1945   log-buffer-size 1
1946    
1947
1948 log-max-lines is the maximum number of lines held in the log buffer. See above.
1949
1950   log-max-lines 200
1951    
1952
1953 If "log-highlight-messages" is set to 1, Privoxy will highlight portions of the
1954 log messages with a bold-faced font:
1955
1956   log-highlight-messages 1
1957    
1958
1959 The font used in the console window:
1960
1961   log-font-name Comic Sans MS
1962    
1963
1964 Font size used in the console window:
1965
1966   log-font-size 8
1967    
1968
1969 "show-on-task-bar" controls whether or not Privoxy will appear as a button on
1970 the Task bar when minimized:
1971
1972   show-on-task-bar 0
1973    
1974
1975 If "close-button-minimizes" is set to 1, the Windows close button will minimize
1976 Privoxy instead of closing the program (close with the exit option on the File
1977 menu).
1978
1979   close-button-minimizes 1
1980    
1981
1982 The "hide-console" option is specific to the MS-Win console version of Privoxy.
1983 If this option is used, Privoxy will disconnect from and hide the command
1984 console.
1985
1986   #hide-console
1987    
1988
1989 -------------------------------------------------------------------------------
1990
1991 8. Actions Files
1992
1993 The actions files are used to define what actions Privoxy takes for which URLs,
1994 and thus determine how ad images, cookies and various other aspects of HTTP
1995 content and transactions are handled, and on which sites (or even parts
1996 thereof). There are three such files included with Privoxy with differing
1997 purposes:
1998
1999   * default.action - is the primary action file that sets the initial values
2000     for all actions. It is intended to provide a base level of functionality
2001     for Privoxy's array of features. So it is a set of broad rules that should
2002     work reasonably well for users everywhere. This is the file that the
2003     developers are keeping updated, and making available to users.
2004    
2005   * user.action - is intended to be for local site preferences and exceptions.
2006     As an example, if your ISP or your bank has specific requirements, and need
2007     special handling, this kind of thing should go here. This file will not be
2008     upgraded.
2009    
2010   * standard.action - is used by the web based editor, to set various
2011     pre-defined sets of rules for the default actions section in
2012     default.action. These have increasing levels of aggressiveness and have no
2013     influence on your browsing unless you select them explicitly in the editor.
2014     It is not recommend to edit this file.
2015    
2016     The default profiles, and their associated actions, as pre-defined in
2017     standard.action are:
2018    
2019     Table 1. Default Configurations
2020    
2021     +-------------------------------------------------------------------------+
2022     |Feature           |Cautious         |Medium           |Adventuresome     |
2023     |------------------+-----------------+-----------------+------------------|
2024     |Ad-blocking by URL|yes              |yes              |yes               |
2025     |------------------+-----------------+-----------------+------------------|
2026     |Ad-filtering by   |yes              |yes              |yes               |
2027     |size              |                 |                 |                  |
2028     |------------------+-----------------+-----------------+------------------|
2029     |GIF de-animation  |no               |yes              |yes               |
2030     |------------------+-----------------+-----------------+------------------|
2031     |Referer forging   |no               |yes              |yes               |
2032     |------------------+-----------------+-----------------+------------------|
2033     |Cookie handling   |none             |session-only     |kill              |
2034     |------------------+-----------------+-----------------+------------------|
2035     |Pop-up killing    |unsolicited      |unsolicited      |all               |
2036     |------------------+-----------------+-----------------+------------------|
2037     |Fast redirects    |no               |no               |yes               |
2038     |------------------+-----------------+-----------------+------------------|
2039     |HTML taming       |yes              |yes              |yes               |
2040     |------------------+-----------------+-----------------+------------------|
2041     |JavaScript taming |yes              |yes              |yes               |
2042     |------------------+-----------------+-----------------+------------------|
2043     |Web-bug killing   |yes              |yes              |yes               |
2044     |------------------+-----------------+-----------------+------------------|
2045     |Fun text          |no               |no               |yes               |
2046     |replacements      |                 |                 |                  |
2047     |------------------+-----------------+-----------------+------------------|
2048     |Image tag         |no               |no               |yes               |
2049     |reordering        |                 |                 |                  |
2050     |------------------+-----------------+-----------------+------------------|
2051     |Ad-filtering by   |no               |no               |yes               |
2052     |link              |                 |                 |                  |
2053     |------------------+-----------------+-----------------+------------------|
2054     |Demoronizer       |no               |yes              |yes               |
2055     +-------------------------------------------------------------------------+
2056    
2057 The list of actions files to be used are defined in the main configuration
2058 file, and are processed in the order they are defined (e.g. default.action is
2059 typically process before user.action). The content of these can all be viewed
2060 and edited from http://config.privoxy.org/show-status.
2061
2062 An actions file typically has multiple sections. If you want to use "aliases"
2063 in an actions file, you have to place the (optional) alias section at the top
2064 of that file. Then comes the default set of rules which will apply universally
2065 to all sites and pages (be very careful with using such a universal set in
2066 user.action or any other actions file after default.action, because it will
2067 override the result from consulting any previous file). And then below that,
2068 exceptions to the defined universal policies. You can regard user.action as an
2069 appendix to default.action, with the advantage that is a separate file, which
2070 makes preserving your personal settings across Privoxy upgrades easier.
2071
2072 Actions can be used to block anything you want, including ads, banners, or just
2073 some obnoxious URL that you would rather not see. Cookies can be accepted or
2074 rejected, or accepted only during the current browser session (i.e. not written
2075 to disk), content can be modified, JavaScripts tamed, user-tracking fooled, and
2076 much more. See below for a complete list of actions.
2077
2078 -------------------------------------------------------------------------------
2079
2080 8.1. Finding the Right Mix
2081
2082 Note that some actions, like cookie suppression or script disabling, may render
2083 some sites unusable that rely on these techniques to work properly. Finding the
2084 right mix of actions is not always easy and certainly a matter of personal
2085 taste. In general, it can be said that the more "aggressive" your default
2086 settings (in the top section of the actions file) are, the more exceptions for
2087 "trusted" sites you will have to make later. If, for example, you want to
2088 crunch all cookies per default, you'll have to make exceptions from that rule
2089 for sites that you regularly use and that require cookies for actually useful
2090 puposes, like maybe your bank, favorite shop, or newspaper.
2091
2092 We have tried to provide you with reasonable rules to start from in the
2093 distribution actions files. But there is no general rule of thumb on these
2094 things. There just are too many variables, and sites are constantly changing.
2095 Sooner or later you will want to change the rules (and read this chapter again
2096 :).
2097
2098 -------------------------------------------------------------------------------
2099
2100 8.2. How to Edit
2101
2102 The easiest way to edit the actions files is with a browser by using our
2103 browser-based editor, which can be reached from http://config.privoxy.org/
2104 show-status. The editor allows both fine-grained control over every single
2105 feature on a per-URL basis, and easy choosing from wholesale sets of defaults
2106 like "Cautious", "Medium" or "Adventuresome". Warning: the "Adventuresome"
2107 setting is not only more aggressive, but includes settings that are fun and
2108 subversive, and which some may find of dubious merit!
2109
2110 If you prefer plain text editing to GUIs, you can of course also directly edit
2111 the the actions files. Look at default.action which is richly commented.
2112
2113 -------------------------------------------------------------------------------
2114
2115 8.3. How Actions are Applied to URLs
2116
2117 Actions files are divided into sections. There are special sections, like the "
2118 alias" sections which will be discussed later. For now let's concentrate on
2119 regular sections: They have a heading line (often split up to multiple lines
2120 for readability) which consist of a list of actions, separated by whitespace
2121 and enclosed in curly braces. Below that, there is a list of URL patterns, each
2122 on a separate line.
2123
2124 To determine which actions apply to a request, the URL of the request is
2125 compared to all patterns in each action file file. Every time it matches, the
2126 list of applicable actions for the URL is incrementally updated, using the
2127 heading of the section in which the pattern is located. If multiple matches for
2128 the same URL set the same action differently, the last match wins. If not, the
2129 effects are aggregated. E.g. a URL might match a regular section with a heading
2130 line of { +handle-as-image }, then later another one with just { +block },
2131 resulting in both actions to apply.
2132
2133 You can trace this process for any given URL by visiting http://
2134 config.privoxy.org/show-url-info.
2135
2136 More detail on this is provided in the Appendix, Anatomy of an Action.
2137
2138 -------------------------------------------------------------------------------
2139
2140 8.4. Patterns
2141
2142 As mentioned, Privoxy uses "patterns" to determine what actions might apply to
2143 which sites and pages your browser attempts to access. These "patterns" use
2144 wild card type pattern matching to achieve a high degree of flexibility. This
2145 allows one expression to be expanded and potentially match against many similar
2146 patterns.
2147
2148 Generally, a Privoxy pattern has the form <domain>/<path>, where both the
2149 <domain> and <path> are optional. (This is why the special / pattern matches
2150 all URLs). Note that the protocol portion of the URL pattern (e.g. http://)
2151 should not be included in the pattern. This is assumed already!
2152
2153 www.example.com/
2154    
2155     is a domain-only pattern and will match any request to www.example.com,
2156     regardless of which document on that server is requested.
2157    
2158 www.example.com
2159    
2160     means exactly the same. For domain-only patterns, the trailing / may be
2161     omitted.
2162    
2163 www.example.com/index.html
2164    
2165     matches only the single document /index.html on www.example.com.
2166    
2167 /index.html
2168    
2169     matches the document /index.html, regardless of the domain, i.e. on any web
2170     server.
2171    
2172 index.html
2173    
2174     matches nothing, since it would be interpreted as a domain name and there
2175     is no top-level domain called .html.
2176    
2177 -------------------------------------------------------------------------------
2178
2179 8.4.1. The Domain Pattern
2180
2181 The matching of the domain part offers some flexible options: if the domain
2182 starts or ends with a dot, it becomes unanchored at that end. For example:
2183
2184 .example.com
2185    
2186     matches any domain that ENDS in .example.com
2187    
2188 www.
2189    
2190     matches any domain that STARTS with www.
2191    
2192 .example.
2193    
2194     matches any domain that CONTAINS .example. (Correctly speaking: It matches
2195     any FQDN that contains example as a domain.)
2196    
2197 Additionally, there are wild-cards that you can use in the domain names
2198 themselves. They work pretty similar to shell wild-cards: "*" stands for zero
2199 or more arbitrary characters, "?" stands for any single character, you can
2200 define character classes in square brackets and all of that can be freely
2201 mixed:
2202
2203 ad*.example.com
2204    
2205     matches "adserver.example.com", "ads.example.com", etc but not
2206     "sfads.example.com"
2207    
2208 *ad*.example.com
2209    
2210     matches all of the above, and then some.
2211    
2212 .?pix.com
2213    
2214     matches www.ipix.com, pictures.epix.com, a.b.c.d.e.upix.com etc.
2215    
2216 www[1-9a-ez].example.c*
2217    
2218     matches www1.example.com, www4.example.cc, wwwd.example.cy,
2219     wwwz.example.com etc., but not wwww.example.com.
2220    
2221 -------------------------------------------------------------------------------
2222
2223 8.4.2. The Path Pattern
2224
2225 Privoxy uses Perl compatible regular expressions (through the PCRE library) for
2226 matching the path.
2227
2228 There is an Appendix with a brief quick-start into regular expressions, and
2229 full (very technical) documentation on PCRE regex syntax is available on-line
2230 at http://www.pcre.org/man.txt. You might also find the Perl man page on
2231 regular expressions (man perlre) useful, which is available on-line at http://
2232 www.perldoc.com/perl5.6/pod/perlre.html.
2233
2234 Note that the path pattern is automatically left-anchored at the "/", i.e. it
2235 matches as if it would start with a "^" (regular expression speak for the
2236 beginning of a line).
2237
2238 Please also note that matching in the path is CASE INSENSITIVE by default, but
2239 you can switch to case sensitive at any point in the pattern by using the "(?
2240 -i)" switch: www.example.com/(?-i)PaTtErN.* will match only documents whose
2241 path starts with PaTtErN in exactly this capitalization.
2242
2243 -------------------------------------------------------------------------------
2244
2245 8.5. Actions
2246
2247 All actions are disabled by default, until they are explicitly enabled
2248 somewhere in an actions file. Actions are turned on if preceded with a "+", and
2249 turned off if preceded with a "-". So a +action means "do that action", e.g.
2250 +block means "please block URLs that match the following patterns", and -block
2251 means "don't block URLs that match the following patterns, even if +block
2252 previously applied." 
2253
2254 Again, actions are invoked by placing them on a line, enclosed in curly braces
2255 and separated by whitespace, like in {+some-action -some-other-action
2256 {some-parameter}}, followed by a list of URL patterns, one per line, to which
2257 they apply. Together, the actions line and the following pattern lines make up
2258 a section of the actions file.
2259
2260 There are three classes of actions:
2261
2262   * Boolean, i.e the action can only be "enabled" or "disabled". Syntax:
2263    
2264       +name        # enable action name                                
2265       -name        # disable action name                               
2266    
2267     Example: +block
2268    
2269   * Parameterized, where some value is required in order to enable this type of
2270     action. Syntax:
2271    
2272       +name{param}  # enable action and set parameter to param,             
2273                    # overwriting parameter from previous match if necessary 
2274       -name         # disable action. The parameter can be omitted          
2275    
2276     Note that if the URL matches multiple positive forms of a parameterized
2277     action, the last match wins, i.e. the params from earlier matches are
2278     simply ignored.
2279    
2280     Example: +hide-user-agent{ Mozilla 1.0 }
2281    
2282   * Multi-value. These look exactly like parameterized actions, but they behave
2283     differently: If the action applies multiple times to the same URL, but with
2284     different parameters, all the parameters from all matches are remembered.
2285     This is used for actions that can be executed for the same request
2286     repeatedly, like adding multiple headers, or filtering through multiple
2287     filters. Syntax:
2288    
2289       +name{param}   # enable action and add param to the list of parameters                 
2290       -name{param}   # remove the parameter param from the list of parameters                
2291                     # If it was the last one left, disable the action.                       
2292       -name          # disable this action completely and remove all parameters from the list
2293    
2294     Examples: +add-header{X-Fun-Header: Some text} and +filter{html-annoyances}
2295    
2296 If nothing is specified in any actions file, no "actions" are taken. So in this
2297 case Privoxy would just be a normal, non-blocking, non-anonymizing proxy. You
2298 must specifically enable the privacy and blocking features you need (although
2299 the provided default actions files will give a good starting point).
2300
2301 Later defined actions always over-ride earlier ones. So exceptions to any rules
2302 you make, should come in the latter part of the file (or in a file that is
2303 processed later when using multiple actions files). For multi-valued actions,
2304 the actions are applied in the order they are specified. Actions files are
2305 processed in the order they are defined in config (the default installation has
2306 three actions files). It also quite possible for any given URL pattern to match
2307 more than one pattern and thus more than one set of actions!
2308
2309 The list of valid Privoxy actions are:
2310
2311 -------------------------------------------------------------------------------
2312
2313 8.5.1. add-header
2314
2315 Typical use:
2316    
2317     Confuse log analysis, custom applications
2318    
2319 Effect:
2320    
2321     Sends a user defined HTTP header to the web server.
2322    
2323 Type:
2324    
2325     Multi-value.
2326    
2327 Parameter:
2328    
2329     Any string value is possible. Validity of the defined HTTP headers is not
2330     checked. It is recommended that you use the "X-" prefix for custom headers.
2331    
2332 Notes:
2333    
2334     This action may be specified multiple times, in order to define multiple
2335     headers. This is rarely needed for the typical user. If you don't know what
2336     "HTTP headers" are, you definitely don't need to worry about this one.
2337    
2338 Example usage:
2339    
2340     +add-header{X-User-Tracking: sucks}                                
2341    
2342 -------------------------------------------------------------------------------
2343
2344 8.5.2. block
2345
2346 Typical use:
2347    
2348     Block ads or other obnoxious content
2349    
2350 Effect:
2351    
2352     Requests for URLs to which this action applies are blocked, i.e. the
2353     requests are not forwarded to the remote server, but answered locally with
2354     a substitute page or image, as determined by the handle-as-image and 
2355     set-image-blocker actions.
2356    
2357 Type:
2358    
2359     Boolean.
2360    
2361 Parameter:
2362    
2363     N/A
2364    
2365 Notes:
2366    
2367     Privoxy sends a special "BLOCKED" page for requests to blocked pages. This
2368     page contains links to find out why the request was blocked, and a
2369     click-through to the blocked content (the latter only if compiled with the
2370     force feature enabled). The "BLOCKED" page adapts to the available screen
2371     space -- it displays full-blown if space allows, or miniaturized and
2372     text-only if loaded into a small frame or window. If you are using Privoxy
2373     right now, you can take a look at the "BLOCKED" page.
2374    
2375     A very important exception occurs if both block and handle-as-image, apply
2376     to the same request: it will then be replaced by an image. If 
2377     set-image-blocker (see below) also applies, the type of image will be
2378     determined by its parameter, if not, the standard checkerboard pattern is
2379     sent.
2380    
2381     It is important to understand this process, in order to understand how
2382     Privoxy deals with ads and other unwanted content.
2383    
2384     The filter action can perform a very similar task, by "blocking" banner
2385     images and other content through rewriting the relevant URLs in the
2386     document's HTML source, so they don't get requested in the first place.
2387     Note that this is a totally different technique, and it's easy to confuse
2388     the two.
2389    
2390 Example usage (section):
2391    
2392     {+block}      # Block and replace with "blocked" page              
2393     .nasty-stuff.example.com                                           
2394                                                                        
2395     {+block +handle-as-image} # Block and replace with image           
2396     .ad.doubleclick.net                                                
2397     .ads.r.us                                                          
2398    
2399 -------------------------------------------------------------------------------
2400
2401 8.5.3. crunch-incoming-cookies
2402
2403 Typical use:
2404    
2405     Prevent the web server from setting any cookies on your system
2406    
2407 Effect:
2408    
2409     Deletes any "Set-Cookie:" HTTP headers from server replies.
2410    
2411 Type:
2412    
2413     Boolean.
2414    
2415 Parameter:
2416    
2417     N/A
2418    
2419 Notes:
2420    
2421     This action is only concerned with incoming cookies. For outgoing cookies,
2422     use crunch-outgoing-cookies. Use both to disable cookies completely.
2423    
2424     It makes no sense at all to use this action in conjunction with the 
2425     session-cookies-only action, since it would prevent the session cookies
2426     from being set. See also filter-content-cookies.
2427    
2428 Example usage:
2429    
2430     +crunch-incoming-cookies                                           
2431    
2432 -------------------------------------------------------------------------------
2433
2434 8.5.4. crunch-outgoing-cookies
2435
2436 Typical use:
2437    
2438     Prevent the web server from reading any cookies from your system
2439    
2440 Effect:
2441    
2442     Deletes any "Cookie:" HTTP headers from client requests.
2443    
2444 Type:
2445    
2446     Boolean.
2447    
2448 Parameter:
2449    
2450     N/A
2451    
2452 Notes:
2453    
2454     This action is only concerned with outgoing cookies. For incoming cookies,
2455     use crunch-incoming-cookies. Use both to disable cookies completely.
2456    
2457     It makes no sense at all to use this action in conjunction with the 
2458     session-cookies-only action, since it would prevent the session cookies
2459     from being read.
2460    
2461 Example usage:
2462    
2463     +crunch-outgoing-cookies                                           
2464    
2465 -------------------------------------------------------------------------------
2466
2467 8.5.5. deanimate-gifs
2468
2469 Typical use:
2470    
2471     Stop those annoying, distracting animated GIF images.
2472    
2473 Effect:
2474    
2475     De-animate GIF animations, i.e. reduce them to their first or last image.
2476    
2477 Type:
2478    
2479     Parameterized.
2480    
2481 Parameter:
2482    
2483     "last" or "first"
2484    
2485 Notes:
2486    
2487     This will also shrink the images considerably (in bytes, not pixels!). If
2488     the option "first" is given, the first frame of the animation is used as
2489     the replacement. If "last" is given, the last frame of the animation is
2490     used instead, which probably makes more sense for most banner animations,
2491     but also has the risk of not showing the entire last frame (if it is only a
2492     delta to an earlier frame).
2493    
2494     You can safely use this action with patterns that will also match non-GIF
2495     objects, because no attempt will be made at anything that doesn't look like
2496     a GIF.
2497    
2498 Example usage:
2499    
2500     +deanimate-gifs{last}                                              
2501    
2502 -------------------------------------------------------------------------------
2503
2504 8.5.6. downgrade-http-version
2505
2506 Typical use:
2507    
2508     Work around (very rare) problems with HTTP/1.1
2509    
2510 Effect:
2511    
2512     Downgrades HTTP/1.1 client requests and server replies to HTTP/1.0.
2513    
2514 Type:
2515    
2516     Boolean.
2517    
2518 Parameter:
2519    
2520     N/A
2521    
2522 Notes:
2523    
2524     This is a left-over from the time when Privoxy didn't support important
2525     HTTP/1.1 features well. It is left here for the unlikely case that you
2526     experience HTTP/1.1 related problems with some server out there. Not all
2527     (optional) HTTP/1.1 features are supported yet, so there is a chance you
2528     might need this action.
2529    
2530 Example usage (section):
2531    
2532     {+downgrade-http-version}                                          
2533     problem-host.example.com                                           
2534    
2535 -------------------------------------------------------------------------------
2536
2537 8.5.7. fast-redirects
2538
2539 Typical use:
2540    
2541     Fool some click-tracking scripts and speed up indirect links
2542    
2543 Effect:
2544    
2545     Cut off all but the last valid URL from requests.
2546    
2547 Type:
2548    
2549     Boolean.
2550    
2551 Parameter:
2552    
2553     N/A
2554    
2555 Notes:
2556    
2557     Many sites, like yahoo.com, don't just link to other sites. Instead, they
2558     will link to some script on their own servers, giving the destination as a
2559     parameter, which will then redirect you to the final target. URLs resulting
2560     from this scheme typically look like: http://some.place/click-tracker.cgi?
2561     target=http://some.where.else.
2562    
2563     Sometimes, there are even multiple consecutive redirects encoded in the
2564     URL. These redirections via scripts make your web browsing more traceable,
2565     since the server from which you follow such a link can see where you go to.
2566     Apart from that, valuable bandwidth and time is wasted, while your browser
2567     ask the server for one redirect after the other. Plus, it feeds the
2568     advertisers.
2569    
2570     This feature is currently not very smart and is scheduled for improvement.
2571     It is likely to break some sites. You should expect to need possibly many
2572     exceptions to this action, if it is enabled by default in default.action.
2573     Some sites just don't work without it.
2574    
2575 Example usage:
2576    
2577     {+fast-redirects}                                                  
2578    
2579 -------------------------------------------------------------------------------
2580
2581 8.5.8. filter
2582
2583 Typical use:
2584    
2585     Get rid of HTML and JavaScript annoyances, banner advertisements (by size),
2586     do fun text replacements, etc.
2587    
2588 Effect:
2589    
2590     Text documents, including HTML and JavaScript, to which this action
2591     applies, are filtered on-the-fly through the specified regular expression
2592     based substitutions.
2593    
2594 Type:
2595    
2596     Parameterized.
2597    
2598 Parameter:
2599    
2600     The name of a filter, as defined in the filter file (typically
2601     default.filter, set by the filterfile option in the config file). Filtering
2602     can be completely disabled without the use of parameters.
2603    
2604 Notes:
2605    
2606     For your convenience, there are a number of pre-defined filters available
2607     in the distribution filter file that you can use. See the examples below
2608     for a list.
2609    
2610     This is potentially a very powerful feature! But "rolling your own" filters
2611     requires a knowledge of regular expressions and HTML.
2612    
2613     Filtering requires buffering the page content, which may appear to slow
2614     down page rendering since nothing is displayed until all content has passed
2615     the filters. (It does not really take longer, but seems that way since the
2616     page is not incrementally displayed.) This effect will be more noticeable
2617     on slower connections.
2618    
2619     The amount of data that can be filtered is limited to the buffer-limit
2620     option in the main config file. The default is 4096 KB (4 Megs). Once this
2621     limit is exceeded, the buffered data, and all pending data, is passed
2622     through unfiltered.
2623    
2624     Inappropriate MIME types, such as zipped files, are not filtered at all.
2625     Encrypted SSL data (from HTTPS servers) cannot be filtered either since
2626     this would violate the integrity of the secure transaction.
2627    
2628     At this time, Privoxy cannot (yet!) uncompress compressed documents. If you
2629     want filtering to work on all documents, even those that would normally be
2630     sent compressed, use the prevent-compression action in conjunction with
2631     filter.
2632    
2633     Filtering can achieve some of the same effects as the block action, i.e. it
2634     can be used to block ads and banners. But the mechanism works quite
2635     differently. One effective use, is to block ad banners based on their size
2636     (see below), since many of these seem to be somewhat standardized.
2637    
2638     Feedback with suggestions for new or improved filters is particularly
2639     welcome!
2640    
2641 Example usage (with filters from the distribution default.filter file):
2642    
2643     +filter{js-annoyances}       # Get rid of particularly annoying JavaScript abuse
2644    
2645     +filter{js-events}           # Kill all JS event bindings (Radically destructive! Only for extra nasty sites)
2646    
2647     +filter{html-annoyances}     # Get rid of particularly annoying HTML abuse
2648    
2649     +filter{content-cookies}     # Kill cookies that come in the HTML or JS content
2650    
2651     +filter{refresh-tags}        # Kill automatic refresh tags (for dial-on-demand setups)
2652    
2653     +filter{unsolicited-popups}  # Disable only unsolicited pop-up windows
2654    
2655     +filter{all-popups}          # Kill all popups in JavaScript and HTML
2656    
2657     +filter{img-reorder}         # Reorder attributes in <img> tags to make the banners-by-* filters more effective
2658    
2659     +filter{banners-by-size}     # Kill banners by size                
2660    
2661     +filter{banners-by-link}     # Kill banners by their links to known clicktrackers
2662    
2663     +filter{webbugs}             # Squish WebBugs (1x1 invisible GIFs used for user tracking)
2664    
2665     +filter{tiny-textforms}      # Extend those tiny textareas up to 40x80 and kill the hard wrap
2666    
2667     +filter{jumping-windows}     # Prevent windows from resizing and moving themselves
2668    
2669     +filter{frameset-borders}    # Give frames a border and make them resizable
2670    
2671     +filter{demoronizer}         # Fix MS's non-standard use of standard charsets
2672    
2673     +filter{shockwave-flash}     # Kill embedded Shockwave Flash objects
2674    
2675     +filter{quicktime-kioskmode} # Make Quicktime movies saveable      
2676    
2677     +filter{fun}                 # Text replacements for subversive browsing fun!
2678    
2679     +filter{crude-parental}      # Crude parental filtering (demo only)
2680    
2681     +filter{ie-exploits}         # Disable some known Internet Explorer bug exploits
2682    
2683 -------------------------------------------------------------------------------
2684
2685 8.5.9. handle-as-image
2686
2687 Typical use:
2688    
2689     Mark URLs as belonging to images (so they'll be replaced by images if they
2690     get blocked)
2691    
2692 Effect:
2693    
2694     This action alone doesn't do anything noticeable. It just marks URLs as
2695     images. If the block action also applies, the presence or absence of this
2696     mark decides whether an HTML "blocked" page, or a replacement image (as
2697     determined by the set-image-blocker action) will be sent to the client as a
2698     substitute for the blocked content.
2699    
2700 Type:
2701    
2702     Boolean.
2703    
2704 Parameter:
2705    
2706     N/A
2707    
2708 Notes:
2709    
2710     The below generic example section is actually part of default.action. It
2711     marks all URLs with well-known image file name extensions as images and
2712     should be left intact.
2713    
2714     Users will probably only want to use the handle-as-image action in
2715     conjunction with block, to block sources of banners, whose URLs don't
2716     reflect the file type, like in the second example section.
2717    
2718     Note that you cannot treat HTML pages as images in most cases. For
2719     instance, (in-line) ad frames require an HTML page to be sent, or they
2720     won't display properly. Forcing handle-as-image in this situation will not
2721     replace the ad frame with an image, but lead to error messages.
2722    
2723 Example usage (sections):
2724    
2725     # Generic image extensions:                                        
2726     #                                                                  
2727     {+handle-as-image}                                                 
2728     /.*\.(gif|jpg|jpeg|png|bmp|ico)$                                   
2729                                                                        
2730     # These don't look like images, but they're banners and should be  
2731     # blocked as images:                                               
2732     #                                                                  
2733     {+block +handle-as-image}                                          
2734     some.nasty-banner-server.com/junk.cgi?output=trash                 
2735                                                                        
2736     # Banner source! Who cares if they also have non-image content?    
2737     ad.doubleclick.net                                                 
2738    
2739 -------------------------------------------------------------------------------
2740
2741 8.5.10. hide-forwarded-for-headers
2742
2743 Typical use:
2744    
2745     Improve privacy by hiding the true source of the request
2746    
2747 Effect:
2748    
2749     Deletes any existing "X-Forwarded-for:" HTTP header from client requests,
2750     and prevents adding a new one.
2751    
2752 Type:
2753    
2754     Boolean.
2755    
2756 Parameter:
2757    
2758     N/A
2759    
2760 Notes:
2761    
2762     It is fairly safe to leave this on.
2763    
2764     This action is scheduled for improvement: It should be able to generate
2765     forged "X-Forwarded-for:" headers using random IP addresses from a
2766     specified network, to make successive requests from the same client look
2767     like requests from a pool of different users sharing the same proxy.
2768    
2769 Example usage:
2770    
2771     +hide-forwarded-for-headers                                        
2772    
2773 -------------------------------------------------------------------------------
2774
2775 8.5.11. hide-from-header
2776
2777 Typical use:
2778    
2779     Keep your (old and ill) browser from telling web servers your email address
2780    
2781 Effect:
2782    
2783     Deletes any existing "From:" HTTP header, or replaces it with the specified
2784     string.
2785    
2786 Type:
2787    
2788     Parameterized.
2789    
2790 Parameter:
2791    
2792     Keyword: "block", or any user defined value.
2793    
2794 Notes:
2795    
2796     The keyword "block" will completely remove the header (not to be confused
2797     with the block action).
2798    
2799     Alternately, you can specify any value you prefer to be sent to the web
2800     server. If you do, it is a matter of fairness not to use any address that
2801     is actually used by a real person.
2802    
2803     This action is rarely needed, as modern web browsers don't send "From:"
2804     headers anymore.
2805    
2806 Example usage:
2807    
2808     +hide-from-header{block}                                           
2809    
2810     or
2811    
2812     +hide-from-header{spam-me-senseless@sittingduck.example.com}       
2813    
2814 -------------------------------------------------------------------------------
2815
2816 8.5.12. hide-referrer
2817
2818 Typical use:
2819    
2820     Conceal which link you followed to get to a particular site
2821    
2822 Effect:
2823    
2824     Deletes the "Referer:" (sic) HTTP header from the client request, or
2825     replaces it with a forged one.
2826    
2827 Type:
2828    
2829     Parameterized.
2830    
2831 Parameter:
2832    
2833       + "block" to delete the header completely.
2834        
2835       + "forge" to pretend to be coming from the homepage of the server we are
2836         talking to.
2837        
2838       + Any other string to set a user defined referrer.
2839        
2840 Notes:
2841    
2842     "forge" is the preferred option here, since some servers will not send
2843     images back otherwise, in an attempt to prevent their valuable content from
2844     being embedded elsewhere (and hence, without being surrounded by their
2845     banners).
2846    
2847     hide-referer is an alternate spelling of hide-referrer and the two can be
2848     can be freely substituted with each other. ("referrer" is the correct
2849     English spelling, however the HTTP specification has a bug - it requires it
2850     to be spelled as "referer".)
2851    
2852 Example usage:
2853    
2854     +hide-referrer{forge}                                              
2855    
2856     or
2857    
2858     +hide-referrer{http://www.yahoo.com/}                              
2859    
2860 -------------------------------------------------------------------------------
2861
2862 8.5.13. hide-user-agent
2863
2864 Typical use:
2865    
2866     Conceal your type of browser and client operating system
2867    
2868 Effect:
2869    
2870     Replaces the value of the "User-Agent:" HTTP header in client requests with
2871     the specified value.
2872    
2873 Type:
2874    
2875     Parameterized.
2876    
2877 Parameter:
2878    
2879     Any user-defined string.
2880    
2881 Notes:
2882    
2883     +-----------------------------------------------------------------+
2884     |                             Warning                             |
2885     |-----------------------------------------------------------------|
2886     |This breaks many web sites that depend on looking at this header |
2887     |in order to customize their content for different browsers       |
2888     |(which, by the way, is NOT a smart way to do that!).             |
2889     +-----------------------------------------------------------------+
2890    
2891     Using this action in multi-user setups or wherever different types of
2892     browsers will access the same Privoxy is not recommended. In single-user,
2893     single-browser setups, you might use it to delete your OS version
2894     information from the headers, because it is an invitation to exploit known
2895     bugs for your OS. It is also occasionally useful to forge this in order to
2896     access sites that won't let you in otherwise (though there may be a good
2897     reason in some cases). Example of this: some MSN sites will not let Mozilla
2898     enter, yet forging to a Netscape 6.1 user-agent works just fine. (Must be
2899     just a silly MS goof, I'm sure :-).
2900    
2901     This action is scheduled for improvement.
2902    
2903 Example usage:
2904    
2905     +hide-user-agent{Netscape 6.1 (X11; I; Linux 2.4.18 i686)}         
2906    
2907 -------------------------------------------------------------------------------
2908
2909 8.5.14. kill-popups
2910
2911 Typical use:
2912    
2913     Eliminate those annoying pop-up windows (deprecated)
2914    
2915 Effect:
2916    
2917     While loading the document, replace JavaScript code that opens pop-up
2918     windows with (syntactically neutral) dummy code on the fly.
2919    
2920 Type:
2921    
2922     Boolean.
2923    
2924 Parameter:
2925    
2926     N/A
2927    
2928 Notes:
2929    
2930     This action is basically a built-in, hardwired special-purpose filter
2931     action, but there are important differences: For kill-popups, the document
2932     need not be buffered, so it can be incrementally rendered while
2933     downloading. But kill-popups doesn't catch as many pop-ups as filter
2934     {all-popups} does and is not as smart as filter{unsolicited-popups} is.
2935    
2936     Think of it as a fast and efficient replacement for a filter that you can
2937     use if you don't want any filtering at all. Note that it doesn't make sense
2938     to combine it with any filter action, since as soon as one filter applies,
2939     the whole document needs to be buffered anyway, which destroys the
2940     advantage of the kill-popups action over its filter equivalent.
2941    
2942     Killing all pop-ups unconditionally is problematic. Many shops and banks
2943     rely on pop-ups to display forms, shopping carts etc, and the filter
2944     {unsolicited-popups} does a fairly good job of catching only the unwanted
2945     ones.
2946    
2947     If the only kind of pop-ups that you want to kill are exit consoles (those
2948     really nasty windows that appear when you close an other one), you might
2949     want to use filter{js-annoyances} instead.
2950    
2951 Example usage:
2952    
2953     +kill-popups                                                       
2954    
2955 -------------------------------------------------------------------------------
2956
2957 8.5.15. limit-connect
2958
2959 Typical use:
2960    
2961     Prevent abuse of Privoxy as a TCP proxy relay
2962    
2963 Effect:
2964    
2965     Specifies to which ports HTTP CONNECT requests are allowable.
2966    
2967 Type:
2968    
2969     Parameterized.
2970    
2971 Parameter:
2972    
2973     A comma-separated list of ports or port ranges (the latter using dashes,
2974     with the minimum defaulting to 0 and the maximum to 65K).
2975    
2976 Notes:
2977    
2978     By default, i.e. if no limit-connect action applies, Privoxy only allows
2979     HTTP CONNECT requests to port 443 (the standard, secure HTTPS port). Use
2980     limit-connect if more fine-grained control is desired for some or all
2981     destinations.
2982    
2983     The CONNECT methods exists in HTTP to allow access to secure websites
2984     ("https://" URLs) through proxies. It works very simply: the proxy connects
2985     to the server on the specified port, and then short-circuits its
2986     connections to the client and to the remote server. This can be a big
2987     security hole, since CONNECT-enabled proxies can be abused as TCP relays
2988     very easily.
2989    
2990     If you don't know what any of this means, there probably is no reason to
2991     change this one, since the default is already very restrictive.
2992    
2993 Example usages:
2994    
2995     +limit-connect{443}                   # This is the default and need not be specified.        
2996     +limit-connect{80,443}                # Ports 80 and 443 are OK.                              
2997     +limit-connect{-3, 7, 20-100, 500-}   # Ports less than 3, 7, 20 to 100 and above 500 are OK. 
2998     +limit-connect{-}                     # All ports are OK (gaping security hole!)              
2999    
3000 -------------------------------------------------------------------------------
3001
3002 8.5.16. prevent-compression
3003
3004 Typical use:
3005    
3006     Ensure that servers send the content uncompressed, so it can be passed
3007     through filters
3008    
3009 Effect:
3010    
3011     Adds a header to the request that asks for uncompressed transfer.
3012    
3013 Type:
3014    
3015     Boolean.
3016    
3017 Parameter:
3018    
3019     N/A
3020    
3021 Notes:
3022    
3023     More and more websites send their content compressed by default, which is
3024     generally a good idea and saves bandwidth. But for the filter, 
3025     deanimate-gifs and kill-popups actions to work, Privoxy needs access to the
3026     uncompressed data. Unfortunately, Privoxy can't yet(!) uncompress, filter,
3027     and re-compress the content on the fly. So if you want to ensure that all
3028     websites, including those that normally compress, can be filtered, you need
3029     to use this action.
3030    
3031     This will slow down transfers from those websites, though. If you use any
3032     of the above-mentioned actions, you will typically want to use
3033     prevent-compression in conjunction with them.
3034    
3035     Note that some (rare) ill-configured sites don't handle requests for
3036     uncompressed documents correctly (they send an empty document body). If you
3037     use prevent-compression per default, you'll have to add exceptions for
3038     those sites. See the example for how to do that.
3039    
3040 Example usage (sections):
3041    
3042     # Set default:                                                     
3043     #                                                                  
3044     {+prevent-compression}                                             
3045     / # Match all sites                                                
3046                                                                        
3047     # Make exceptions for ill sites:                                   
3048     #                                                                  
3049     {-prevent-compression}                                             
3050     www.debianhelp.org                                                 
3051     www.pclinuxonline.com                                              
3052    
3053 -------------------------------------------------------------------------------
3054
3055 8.5.17. send-vanilla-wafer
3056
3057 Typical use:
3058    
3059     Feed log analysis scripts with useless data.
3060    
3061 Effect:
3062    
3063     Sends a cookie with each request stating that you do not accept any
3064     copyright on cookies sent to you, and asking the site operator not to track
3065     you.
3066    
3067 Type:
3068    
3069     Boolean.
3070    
3071 Parameter:
3072    
3073     N/A
3074    
3075 Notes:
3076    
3077     The vanilla wafer is a (relatively) unique header and could conceivably be
3078     used to track you.
3079    
3080     This action is rarely used and not enabled in the default configuration.
3081    
3082 Example usage:
3083    
3084     +send-vanilla-wafer                                                
3085    
3086 -------------------------------------------------------------------------------
3087
3088 8.5.18. send-wafer
3089
3090 Typical use:
3091    
3092     Send custom cookies or feed log analysis scripts with even more useless
3093     data.
3094    
3095 Effect:
3096    
3097     Sends a custom, user-defined cookie with each request.
3098    
3099 Type:
3100    
3101     Multi-value.
3102    
3103 Parameter:
3104    
3105     A string of the form "name=value".
3106    
3107 Notes:
3108    
3109     Being multi-valued, multiple instances of this action can apply to the same
3110     request, resulting in multiple cookies being sent.
3111    
3112     This action is rarely used and not enabled in the default configuration.
3113    
3114 Example usage (section):
3115    
3116     {+send-wafer{UsingPrivoxy=true}}                                   
3117     my-internal-testing-server.void                                    
3118    
3119 -------------------------------------------------------------------------------
3120
3121 8.5.19. session-cookies-only
3122
3123 Typical use:
3124    
3125     Allow only temporary "session" cookies (for the current browser session
3126     only).
3127    
3128 Effect:
3129    
3130     Deletes the "expires" field from "Set-Cookie:" server headers. Most
3131     browsers will not store such cookies permanently and forget them in between
3132     sessions.
3133    
3134 Type:
3135    
3136     Boolean.
3137    
3138 Parameter:
3139    
3140     N/A
3141    
3142 Notes:
3143    
3144     This is less strict than crunch-incoming-cookies / crunch-outgoing-cookies
3145     and allows you to browse websites that insist or rely on setting cookies,
3146     without compromising your privacy too badly.
3147    
3148     Most browsers will not permanently store cookies that have been processed
3149     by session-cookies-only and will forget about them between sessions. This
3150     makes profiling cookies useless, but won't break sites which require
3151     cookies so that you can log in for transactions. This is generally turned
3152     on for all sites, and is the recommended setting.
3153    
3154     It makes no sense at all to use session-cookies-only together with 
3155     crunch-incoming-cookies or crunch-outgoing-cookies. If you do, cookies will
3156     be plainly killed.
3157    
3158     Note that it is up to the browser how it handles such cookies without an
3159     "expires" field. If you use an exotic browser, you might want to try it out
3160     to be sure.
3161    
3162     This setting also has no effect on cookies that may have been stored
3163     previously by the browser before starting Privoxy. These would have to be
3164     removed manually.
3165    
3166     Privoxy also uses the content-cookies filter to block some types of
3167     cookies. Content cookies are not effected by session-cookies-only.
3168    
3169 Example usage:
3170    
3171     +session-cookies-only                                              
3172    
3173 -------------------------------------------------------------------------------
3174
3175 8.5.20. set-image-blocker
3176
3177 Typical use:
3178    
3179     Choose the replacement for blocked images
3180    
3181 Effect:
3182    
3183     This action alone doesn't do anything noticeable. If both block and 
3184     handle-as-image also apply, i.e. if the request is to be blocked as an
3185     image, then the parameter of this action decides what will be sent as a
3186     replacement.
3187    
3188 Type:
3189    
3190     Parameterized.
3191    
3192 Parameter:
3193    
3194       + "pattern" to send a built-in checkerboard pattern image. The image is
3195         visually decent, scales very well, and makes it obvious where banners
3196         were busted.
3197        
3198       + "blank" to send a built-in transparent image. This makes banners
3199         disappear completely, but makes it hard to detect where Privoxy has
3200         blocked images on a given page and complicates troubleshooting if
3201         Privoxy has blocked innocent images, like navigation icons.
3202        
3203       + "target-url" to send a redirect to target-url. You can redirect to any
3204         image anywhere, even in your local filesystem (via "file:///" URL).
3205        
3206         A good application of redirects is to use special Privoxy-built-in
3207         URLs, which send the built-in images, as target-url. This has the same
3208         visual effect as specifying "blank" or "pattern" in the first place,
3209         but enables your browser to cache the replacement image, instead of
3210         requesting it over and over again.
3211        
3212 Notes:
3213    
3214     The URLs for the built-in images are "http://config.privoxy.org/
3215     send-banner?type=type", where type is either "blank" or "pattern".
3216    
3217     There is a third (advanced) type, called "auto". It is NOT to be used in
3218     set-image-blocker, but meant for use from filters. Auto will select the
3219     type of image that would have applied to the referring page, had it been an
3220     image.
3221    
3222 Example usage:
3223    
3224     Built-in pattern:
3225    
3226     +set-image-blocker{pattern}                                        
3227    
3228     Redirect to the BSD devil:
3229    
3230     +set-image-blocker{http://www.freebsd.org/gifs/dae_up3.gif}        
3231    
3232     Redirect to the built-in pattern for better caching:
3233    
3234     +set-image-blocker{http://config.privoxy.org/send-banner?type=pattern}
3235    
3236 -------------------------------------------------------------------------------
3237
3238 8.5.21. Summary
3239
3240 Note that many of these actions have the potential to cause a page to
3241 misbehave, possibly even not to display at all. There are many ways a site
3242 designer may choose to design his site, and what HTTP header content, and other
3243 criteria, he may depend on. There is no way to have hard and fast rules for all
3244 sites. See the Appendix for a brief example on troubleshooting actions.
3245
3246 -------------------------------------------------------------------------------
3247
3248 8.6. Aliases
3249
3250 Custom "actions", known to Privoxy as "aliases", can be defined by combining
3251 other actions. These can in turn be invoked just like the built-in actions.
3252 Currently, an alias name can contain any character except space, tab, "=", "{"
3253 and "}", but we strongly recommend that you only use "a" to "z", "0" to "9",
3254 "+", and "-". Alias names are not case sensitive, and are not required to start
3255 with a "+" or "-" sign, since they are merely textually expanded.
3256
3257 Aliases can be used throughout the actions file, but they must be defined in a
3258 special section at the top of the file! And there can only be one such section
3259 per actions file. Each actions file may have its own alias section, and the
3260 aliases defined in it are only visible within that file.
3261
3262 There are two main reasons to use aliases: One is to save typing for frequently
3263 used combinations of actions, the other one is a gain in flexibility: If you
3264 decide once how you want to handle shops by defining an alias called "shop",
3265 you can later change your policy on shops in one place, and your changes will
3266 take effect everywhere in the actions file where the "shop" alias is used.
3267 Calling aliases by their purpose also makes your actions files more readable.
3268
3269 Currently, there is one big drawback to using aliases, though: Privoxy's
3270 built-in web-based action file editor honors aliases when reading the actions
3271 files, but it expands them before writing. So the effects of your aliases are
3272 of course preserved, but the aliases themselves are lost when you edit sections
3273 that use aliases with it. This is likely to change in future versions of
3274 Privoxy.
3275
3276 Now let's define some aliases...
3277
3278  # Useful custom aliases we can use later.                                                    
3279  #                                                                                            
3280  # Note the (required!) section header line and that this section                             
3281  # must be at the top of the actions file!                                                    
3282  #                                                                                            
3283  {{alias}}                                                                                    
3284                                                                                               
3285  # These aliases just save typing later:                                                      
3286  # (Note that some already use other aliases!)                                                
3287  #                                                                                            
3288  +crunch-all-cookies = +crunch-incoming-cookies +crunch-outgoing-cookies                      
3289  -crunch-all-cookies = -crunch-incoming-cookies -crunch-outgoing-cookies                      
3290  block-as-image      = +block +handle-as-image                                                
3291  mercy-for-cookies   = -crunch-all-cookies -session-cookies-only -filter{content-cookies}     
3292                                                                                               
3293  # These aliases define combinations of actions                                               
3294  # that are useful for certain types of sites:                                                
3295  #                                                                                            
3296  fragile     = -block -filter -crunch-all-cookies -fast-redirects -hide-referrer -kill-popups 
3297  shop        = -crunch-all-cookies -filter{all-popups} -kill-popups                           
3298                                                                                               
3299  # Short names for other aliases, for really lazy people ;-)                                  
3300  #                                                                                            
3301  c0 = +crunch-all-cookies                                                                     
3302  c1 = -crunch-all-cookies                                                                     
3303
3304 ...and put them to use. These sections would appear in the lower part of an
3305 actions file and define exceptions to the default actions (as specified further
3306 up for the "/" pattern):
3307
3308  # These sites are either very complex or very keen on                         
3309  # user data and require minimal interference to work:                         
3310  #                                                                             
3311  {fragile}                                                                     
3312  .office.microsoft.com                                                         
3313  .windowsupdate.microsoft.com                                                  
3314  .nytimes.com                                                                  
3315                                                                                
3316  # Shopping sites:                                                             
3317  # Allow cookies (for setting and retrieving your customer data)               
3318  #                                                                             
3319  {shop}                                                                        
3320  .quietpc.com                                                                  
3321  .worldpay.com   # for quietpc.com                                             
3322  .scan.co.uk                                                                   
3323                                                                                
3324  # These shops require pop-ups:                                                
3325  #                                                                             
3326  {shop -kill-popups -filter{all-popups}}                                       
3327   .dabs.com                                                                    
3328   .overclockers.co.uk                                                          
3329
3330 Aliases like "shop" and "fragile" are often used for "problem" sites that
3331 require some actions to be disabled in order to function properly.
3332
3333 -------------------------------------------------------------------------------
3334
3335 8.7. Actions Files Tutorial
3336
3337 The above chapters have shown which actions files there are and how they are
3338 organized, how actions are specified and applied to URLs, how patterns work,
3339 and how to define and use aliases. Now, let's look at an example default.action
3340 and user.action file and see how all these pieces come together:
3341
3342 -------------------------------------------------------------------------------
3343
3344 8.7.1. default.action
3345
3346 Every config file should start with a short comment stating its purpose:
3347
3348 # Sample default.action file <developers@privoxy.org>                          
3349
3350 Then, since this is the default.action file, the first section is a special
3351 section for internal use that you needn't change or worry about:
3352
3353 ##########################################################################     
3354 # Settings -- Don't change! For internal Privoxy use ONLY.                     
3355 ##########################################################################     
3356                                                                                
3357 {{settings}}                                                                   
3358 for-privoxy-version=3.0                                                        
3359
3360 After that comes the (optional) alias section. We'll use the example section
3361 from the above chapter on aliases, that also explains why and how aliases are
3362 used:
3363
3364 ##########################################################################                    
3365 # Aliases                                                                                     
3366 ##########################################################################                    
3367 {{alias}}                                                                                     
3368                                                                                               
3369  # These aliases just save typing later:                                                      
3370  # (Note that some already use other aliases!)                                                
3371  #                                                                                            
3372  +crunch-all-cookies = +crunch-incoming-cookies +crunch-outgoing-cookies                      
3373  -crunch-all-cookies = -crunch-incoming-cookies -crunch-outgoing-cookies                      
3374  block-as-image      = +block +handle-as-image                                                
3375  mercy-for-cookies   = -crunch-all-cookies -session-cookies-only -filter{content-cookies}     
3376                                                                                               
3377  # These aliases define combinations of actions                                               
3378  # that are useful for certain types of sites:                                                
3379  #                                                                                            
3380  fragile     = -block -filter -crunch-all-cookies -fast-redirects -hide-referrer -kill-popups 
3381  shop        = -crunch-all-cookies -filter{all-popups} -kill-popups                           
3382
3383 Now come the regular sections, i.e. sets of actions, accompanied by URL
3384 patterns to which they apply. Remember all actions are disabled when matching
3385 starts, so we have to explicitly enable the ones we want.
3386
3387 The first regular section is probably the most important. It has only one
3388 pattern, "/", but this pattern matches all URLs. Therefore, the set of actions
3389 used in this "default" section will be applied to all requests as a start. It
3390 can be partly or wholly overridden by later matches further down this file, or
3391 in user.action, but it will still be largely responsible for your overall
3392 browsing experience.
3393
3394 Again, at the start of matching, all actions are disabled, so there is no real
3395 need to disable any actions here, but we will do that nonetheless, to have a
3396 complete listing for your reference. (Remember: a "+" preceding the action name
3397 enables the action, a "-" disables!). Also note how this long line has been
3398 made more readable by splitting it into multiple lines with line continuation.
3399
3400 ##########################################################################     
3401 # "Defaults" section:                                                          
3402 ##########################################################################     
3403  { \                                                                           
3404  -add-header \                                                                 
3405  -block \                                                                      
3406  -crunch-incoming-cookies \                                                    
3407  -crunch-outgoing-cookies \                                                    
3408  +deanimate-gifs \                                                             
3409  -downgrade-http-version \                                                     
3410  +fast-redirects \                                                             
3411  +filter{js-annoyances} \                                                      
3412  -filter{js-events} \                                                          
3413  +filter{html-annoyances} \                                                    
3414  -filter{content-cookies} \                                                    
3415  +filter{refresh-tags} \                                                       
3416  +filter{unsolicited-popups} \                                                 
3417  -filter{all-popups} \                                                         
3418  +filter{img-reorder} \                                                        
3419  +filter{banners-by-size} \                                                    
3420  -filter{banners-by-link} \                                                    
3421  +filter{webbugs} \                                                            
3422  -filter{tiny-textforms} \                                                     
3423  +filter{jumping-windows} \                                                    
3424  -filter{frameset-borders} \                                                   
3425  +filter{demoronizer} \                                                        
3426  -filter{shockwave-flash} \                                                    
3427  -filter{quicktime-kioskmode} \                                                
3428  -filter{fun} \                                                                
3429  -filter{crude-parental} \                                                     
3430  +filter{ie-exploits} \                                                        
3431  -handle-as-image \                                                            
3432  +hide-forwarded-for-headers \                                                 
3433  +hide-from-header{block} \                                                    
3434  +hide-referrer{forge} \                                                       
3435  -hide-user-agent \                                                            
3436  -kill-popups \                                                                
3437  -limit-connect \                                                              
3438  +prevent-compression \                                                        
3439  -send-vanilla-wafer \                                                         
3440  -send-wafer \                                                                 
3441  +session-cookies-only \                                                       
3442  +set-image-blocker{pattern} \                                                 
3443  }                                                                             
3444  / # forward slash will match *all* potential URL patterns.                    
3445
3446 The default behavior is now set. Note that some actions, like not hiding the
3447 user agent, are part of a "general policy" that applies universally and won't
3448 get any exceptions defined later. Other choices, like not blocking (which is
3449 understandably the default!) need exceptions, i.e. we need to specify
3450 explicitly what we want to block in later sections.
3451
3452 The first of our specialized sections is concerned with "fragile" sites, i.e.
3453 sites that require minimum interference, because they are either very complex
3454 or very keen on tracking you (and have mechanisms in place that make them
3455 unusable for people who avoid being tracked). We will simply use our
3456 pre-defined fragile alias instead of stating the list of actions explicitly:
3457
3458 ##########################################################################     
3459 # Exceptions for sites that'll break under the default action set:             
3460 ##########################################################################     
3461                                                                                
3462 # "Fragile" Use a minimum set of actions for these sites (see alias above):    
3463 #                                                                              
3464 { fragile }                                                                    
3465 .office.microsoft.com           # surprise, surprise!                          
3466 .windowsupdate.microsoft.com                                                   
3467
3468 Shopping sites are not as fragile, but they typically require cookies to log
3469 in, and pop-up windows for shopping carts or item details. Again, we'll use a
3470 pre-defined alias:
3471
3472 # Shopping sites:                                                              
3473 #                                                                              
3474 { shop }                                                                       
3475 .quietpc.com                                                                   
3476 .worldpay.com   # for quietpc.com                                              
3477 .jungle.com                                                                    
3478 .scan.co.uk                                                                    
3479
3480 The fast-redirects action, which we enabled per default above, breaks some
3481 sites. So disable it for popular sites where we know it misbehaves:
3482
3483 { -fast-redirects }                                                            
3484 login.yahoo.com                                                                
3485 edit.*.yahoo.com                                                               
3486 .google.com                                                                    
3487 .altavista.com/.*(like|url|link):http                                          
3488 .altavista.com/trans.*urltext=http                                             
3489 .nytimes.com                                                                   
3490
3491 It is important that Privoxy knows which URLs belong to images, so that if they
3492 are to be blocked, a substitute image can be sent, rather than an HTML page.
3493 Contacting the remote site to find out is not an option, since it would destroy
3494 the loading time advantage of banner blocking, and it would feed the
3495 advertisers (in terms of money and information). We can mark any URL as an
3496 image with the handle-as-image action, and marking all URLs that end in a known
3497 image file extension is a good start:
3498
3499 ##########################################################################     
3500 # Images:                                                                      
3501 ##########################################################################     
3502                                                                                
3503 # Define which file types will be treated as images, in case they get          
3504 # blocked further down this file:                                              
3505 #                                                                              
3506 { +handle-as-image }                                                           
3507 /.*\.(gif|jpe?g|png|bmp|ico)$                                                  
3508
3509 And then there are known banner sources. They often use scripts to generate the
3510 banners, so it won't be visible from the URL that the request is for an image.
3511 Hence we block them and mark them as images in one go, with the help of our
3512 block-as-image alias defined above. (We could of course just as well use +block
3513 +handle-as-image here.) Remember that the type of the replacement image is
3514 chosen by the set-image-blocker action. Since all URLs have matched the default
3515 section with its +set-image-blocker{pattern} action before, it still applies
3516 and needn't be repeated:
3517
3518 # Known ad generators:                                                         
3519 #                                                                              
3520 { block-as-image }                                                             
3521 ar.atwola.com                                                                  
3522 .ad.doubleclick.net                                                            
3523 .ad.*.doubleclick.net                                                          
3524 .a.yimg.com/(?:(?!/i/).)*$                                                     
3525 .a[0-9].yimg.com/(?:(?!/i/).)*$                                                
3526 bs*.gsanet.com                                                                 
3527 bs*.einets.com                                                                 
3528 .qkimg.net                                                                     
3529
3530 One of the most important jobs of Privoxy is to block banners. A huge bunch of
3531 them are already "blocked" by the filter{banners-by-size} action, which we
3532 enabled above, and which deletes the references to banner images from the pages
3533 while they are loaded, so the browser doesn't request them anymore, and hence
3534 they don't need to be blocked here. But this naturally doesn't catch all
3535 banners, and some people choose not to use filters, so we need a comprehensive
3536 list of patterns for banner URLs here, and apply the block action to them.
3537
3538 First comes a bunch of generic patterns, which do most of the work, by matching
3539 typical domain and path name components of banners. Then comes a list of
3540 individual patterns for specific sites, which is omitted here to keep the
3541 example short:
3542
3543 ##########################################################################     
3544 # Block these fine banners:                                                    
3545 ##########################################################################     
3546 { +block }                                                                     
3547                                                                                
3548 # Generic patterns:                                                            
3549 #                                                                              
3550 ad*.                                                                           
3551 .*ads.                                                                         
3552 banner?.                                                                       
3553 count*.                                                                        
3554 /.*count(er)?\.(pl|cgi|exe|dll|asp|php[34]?)                                   
3555 /(?:.*/)?(publicite|werbung|rekla(ma|me|am)|annonse|maino(kset|nta|s)?)/       
3556                                                                                
3557 # Site-specific patterns (abbreviated):                                        
3558 #                                                                              
3559 .hitbox.com                                                                    
3560
3561 You wouldn't believe how many advertisers actually call their banner servers
3562 ads.company.com, or call the directory in which the banners are stored simply
3563 "banners". So the above generic patterns are surprisingly effective.
3564
3565 But being very generic, they necessarily also catch URLs that we don't want to
3566 block. The pattern .*ads. e.g. catches "nasty-ads.nasty-corp.com" as intended,
3567 but also "downloads.sourcefroge.net" or "adsl.some-provider.net." So here come
3568 some well-known exceptions to the +block section above.
3569
3570 Note that these are exceptions to exceptions from the default! Consider the URL
3571 "downloads.sourcefroge.net": Initially, all actions are deactivated, so it
3572 wouldn't get blocked. Then comes the defaults section, which matches the URL,
3573 but just deactivates the block action once again. Then it matches .*ads., an
3574 exception to the general non-blocking policy, and suddenly +block applies. And
3575 now, it'll match .*loads., where -block applies, so (unless it matches again
3576 further down) it ends up with no block action applying.
3577
3578 ##########################################################################     
3579 # Save some innocent victims of the above generic block patterns:              
3580 ##########################################################################     
3581                                                                                
3582 # By domain:                                                                   
3583 #                                                                              
3584 { -block }                                                                     
3585 adv[io]*.  # (for advogato.org and advice.*)                                   
3586 adsl.      # (has nothing to do with ads)                                      
3587 ad[ud]*.   # (adult.* and add.*)                                               
3588 .edu       # (universities don't host banners (yet!))                          
3589 .*loads.   # (downloads, uploads etc)                                          
3590                                                                                
3591 # By path:                                                                     
3592 #                                                                              
3593 /.*loads/                                                                      
3594                                                                                
3595 # Site-specific:                                                               
3596 #                                                                              
3597 www.globalintersec.com/adv # (adv = advanced)                                  
3598 www.ugu.com/sui/ugu/adv                                                        
3599
3600 Filtering source code can have nasty side effects, so make an exception for our
3601 friends at sourceforge.net, and all paths with "cvs" in them. Note that -filter
3602 disables all filters in one fell swoop!
3603
3604 # Don't filter code!                                                           
3605 #                                                                              
3606 { -filter }                                                                    
3607 /.*cvs                                                                         
3608 .sourceforge.net                                                               
3609
3610 The actual default.action is of course more comprehensive, but we hope this
3611 example made clear how it works.
3612
3613 -------------------------------------------------------------------------------
3614
3615 8.7.2. user.action
3616
3617 So far we are painting with a broad brush by setting general policies, which
3618 would be a reasonable starting point for many people. Now, you might want to be
3619 more specific and have customized rules that are more suitable to your personal
3620 habits and preferences. These would be for narrowly defined situations like
3621 your ISP or your bank, and should be placed in user.action, which is parsed
3622 after all other actions files and hence has the last word, over-riding any
3623 previously defined actions. user.action is also a safe place for your personal
3624 settings, since default.action is actively maintained by the Privoxy developers
3625 and you'll probably want to install updated versions from time to time.
3626
3627 So let's look at a few examples of things that one might typically do in
3628 user.action:
3629
3630 # My user.action file. <fred@foobar.com>                                       
3631
3632 As aliases are local to the actions file that they are defined in, you can't
3633 use the ones from default.action, unless you repeat them here:
3634
3635 # Aliases are local to the file they are defined in.                                        
3636 # (Re-)define aliases for this file:                                                        
3637 #                                                                                           
3638 {{alias}}                                                                                   
3639 #                                                                                           
3640 # These aliases just save typing later, and the alias names should                          
3641 # be self explanatory.                                                                      
3642 #                                                                                           
3643 +crunch-all-cookies = +crunch-incoming-cookies +crunch-outgoing-cookies                     
3644 -crunch-all-cookies = -crunch-incoming-cookies -crunch-outgoing-cookies                     
3645  allow-all-cookies  = -crunch-all-cookies -session-cookies-only                             
3646  allow-popups       = -filter{all-popups} -kill-popups                                      
3647 +block-as-image     = +block +handle-as-image                                               
3648 -block-as-image     = -block                                                                
3649                                                                                             
3650 # These aliases define combinations of actions that are useful for                          
3651 # certain types of sites:                                                                   
3652 #                                                                                           
3653 fragile     = -block -crunch-all-cookies -filter -fast-redirects -hide-referer -kill-popups 
3654 shop        = -crunch-all-cookies allow-popups                                              
3655                                                                                             
3656 # Allow ads for selected useful free sites:                                                 
3657 #                                                                                           
3658 allow-ads   = -block -filter{banners-by-size} -filter{banners-by-link}                      
3659
3660 Say you have accounts on some sites that you visit regularly, and you don't
3661 want to have to log in manually each time. So you'd like to allow persistent
3662 cookies for these sites. The allow-all-cookies alias defined above does exactly
3663 that, i.e. it disables crunching of cookies in any direction, and the
3664 processing of cookies to make them only temporary.
3665
3666 { allow-all-cookies }                                                          
3667 sunsolve.sun.com                                                               
3668 slashdot.org                                                                   
3669 .yahoo.com                                                                     
3670 .msdn.microsoft.com                                                            
3671 .redhat.com                                                                    
3672
3673 Your bank is allergic to some filter, but you don't know which, so you disable
3674 them all:
3675
3676 { -filter }                                                                    
3677 .your-home-banking-site.com                                                    
3678
3679 Some file types you may not want to filter. Privoxy makes no distinctions
3680 between regular web pages and downloads done via your web browser if it is an
3681 html or text type document.
3682
3683 # A list of common file extensions that are likely to indicate raw text, and best 
3684 # if unfiltered.                                                                  
3685 /(.*/)?.*\.(pl|(s|p)?h|c(c|xx|pp)?|tcl|am|init?|cfg?|conf(ig)?|txt|rc|bat)$       
3686                                                                                   
3687 # Documentation should not need filtering (at least on some sites).               
3688 .tldp.org                                                                         
3689
3690 Example of a simple block action. Say you've seen an ad on your favourite page
3691 on example.com that you want to get rid of. You have right-clicked the image,
3692 selected "copy image location" and pasted the URL below while removing the
3693 leading http://, into a { +block } section. Note that { +handle-as-image } need
3694 not be specified, since all URLs ending in .gif will be tagged as images by the
3695 general rules as set in default.action anyway:
3696
3697 { +block }                                                                     
3698 www.example.com/nasty-ads/sponsor.gif                                          
3699 another.popular.site.net/more/junk/here/                                       
3700                                                                                
3701 #  Here we found one that is not in Privoxy's default blocked list:            
3702 .adfactory.net                                                                 
3703
3704 To force URLs that tend to have ad images, but it is difficult for Privoxy to
3705 know this since the ultimate returned object is obscured for one reason or
3706 another, we can try to force these to be treated as images (and thus avoid
3707 Privoxy's "BLOCKED" banner page). Note that if what is returned by the server
3708 turns out NOT to be an image, then your browser typically will display a broken
3709 icon image. Use cautiously.
3710
3711 { +block-as-image }                                                            
3712 # A shockwave ad, very annoying.                                               
3713 .trip.com/.*\.swf                                                              
3714 .doubleclick.net                                                               
3715 /Realmedia/ads/                                                                
3716 adremote.                                                                      
3717
3718 Now you noticed that the default configuration breaks Forbes Magazine, but you
3719 were too lazy to find out which action is the culprit, and you were again too
3720 lazy to give feedback, so you just used the fragile alias on the site, and --
3721 whoa! -- it worked. The fragile aliases disables those actions that are most
3722 likely to break a site. Also, good for testing purposes to see if it is Privoxy
3723 that is causing the problem or not.
3724
3725 { fragile }                                                                    
3726 .forbes.com                                                                    
3727
3728 You like the "fun" text replacements in default.filter, but it is disabled in
3729 the distributed actions file. (My colleagues on the team just don't have a
3730 sense of humour, that's why! ;-). So you'd like to turn it on in your private,
3731 update-safe config, once and for all:
3732
3733 { +filter{fun} }                                                               
3734 / # For ALL sites!                                                             
3735
3736 Note that the above is not really a good idea: There are exceptions to the
3737 filters in default.action for things that really shouldn't be filtered, like
3738 code on CVS->Web interfaces. Since user.action has the last word, these
3739 exceptions won't be valid for the "fun" filtering specified here.
3740
3741 You might also worry about how your favourite free websites are funded, and
3742 find that they rely on displaying banner advertisements to survive. So you
3743 might want to specifically allow banners for those sites that you feel provide
3744 value to you:
3745
3746 { allow-ads }                                                                  
3747 .sourceforge.net                                                               
3748 .slashdot.org                                                                  
3749 .osdn.net                                                                      
3750
3751 Note that allow-ads has been aliased to -block, -filter{banners-by-size}, and -
3752 filter{banners-by-link} above.
3753
3754 user.action is generally the best place to define exceptions and additions to
3755 the default policies of default.action. Some actions are safe to have their
3756 default policies set here though. So let's set a default policy to have a
3757 "blank" image as opposed to the checkerboard pattern for ALL sites. "/" of
3758 course matches all URL paths and patterns:
3759
3760 { +set-image-blocker{blank} }                                                  
3761 / # ALL sites                                                                  
3762
3763 -------------------------------------------------------------------------------
3764
3765 9. The Filter File
3766
3767 All text substitutions that can be invoked through the filter action must first
3768 be defined in the filter file, which is typically called default.filter and
3769 which can be selected through the filterfile config option.
3770
3771 Typical reasons for doing such substitutions are to eliminate common annoyances
3772 in HTML and JavaScript, such as pop-up windows, exit consoles, crippled windows
3773 without navigation tools, the infamous <BLINK> tag etc, to suppress images with
3774 certain width and height attributes (standard banner sizes or web-bugs), or
3775 just to have fun. The possibilities are endless.
3776
3777 Filtering works on any text-based document type, including plain text, HTML,
3778 JavaScript, CSS etc. (all text/* MIME types). Substitutions are made at the
3779 source level, so if you want to "roll your own" filters, you should be familiar
3780 with HTML syntax.
3781
3782 Just like the actions files, the filter file is organized in sections, which
3783 are called filters here. Each filter consists of a heading line, that starts
3784 with the keyword FILTER:, followed by the filter's name, and a short (one line)
3785 description of what it does. Below that line come the jobs, i.e. lines that
3786 define the actual text substitutions. By convention, the name of a filter
3787 should describe what the filter eliminates. The comment is used in the 
3788 web-based user interface.
3789
3790 Once a filter called name has been defined in the filter file, it can be
3791 invoked by using an action of the form +filter{name} in any actions file.
3792
3793 A filter header line for a filter called "foo" could look like this:
3794
3795 FILTER: foo Replace all "foo" with "bar"                                       
3796
3797 Below that line, and up to the next header line, come the jobs that define what
3798 text replacements the filter executes. They are specified in a syntax that
3799 imitates Perl's s/// operator. If you are familiar with Perl, you will find
3800 this to be quite intuitive, and may want to look at the PCRS man page for the
3801 subtle differences to Perl behaviour. Most notably, the non-standard option
3802 letter U is supported, which turns the default to ungreedy matching.
3803
3804 If you are new to regular expressions, you might want to take a look at the 
3805 Appendix on regular expressions, and see the Perl manual for the s///
3806 operator's syntax and Perl-style regular expressions in general. The below
3807 examples might also help to get you started.
3808
3809 -------------------------------------------------------------------------------
3810
3811 9.1. Filter File Tutorial
3812
3813 Now, let's complete our "foo" filter. We have already defined the heading, but
3814 the jobs are still missing. Since all it does is to replace "foo" with "bar",
3815 there is only one (trivial) job needed:
3816
3817 s/foo/bar/                                                                     
3818
3819 But wait! Didn't the comment say that all occurrences of "foo" should be
3820 replaced? Our current job will only take care of the first "foo" on each page.
3821 For global substitution, we'll need to add the g option:
3822
3823 s/foo/bar/g                                                                    
3824
3825 Our complete filter now looks like this:
3826
3827 FILTER: foo Replace all "foo" with "bar"                                       
3828 s/foo/bar/g                                                                    
3829
3830 Let's look at some real filters for more interesting examples. Here you see a
3831 filter that protects against some common annoyances that arise from JavaScript
3832 abuse. Let's look at its jobs one after the other:
3833
3834 FILTER: js-annoyances Get rid of particularly annoying JavaScript abuse                         
3835                                                                                                 
3836 # Get rid of JavaScript referrer tracking. Test page: http://www.randomoddness.com/untitled.htm 
3837 #                                                                                               
3838 s|(<script.*)document\.referrer(.*</script>)|$1"Not Your Business!"$2|Usg                       
3839
3840 Following the header line and a comment, you see the job. Note that it uses |
3841 as the delimiter instead of /, because the pattern contains a forward slash,
3842 which would otherwise have to be escaped by a backslash (\).
3843
3844 Now, let's examine the pattern: it starts with the text <script.* enclosed in
3845 parentheses. Since the dot matches any character, and * means: "Match an
3846 arbitrary number of the element left of myself", this matches "<script",
3847 followed by any text, i.e. it matches the whole page, from the start of the
3848 first <script> tag.
3849
3850 That's more than we want, but the pattern continues: document\.referrer matches
3851 only the exact string "document.referrer". The dot needed to be escaped, i.e.
3852 preceded by a backslash, to take away its special meaning as a joker, and make
3853 it just a regular dot. So far, the meaning is: Match from the start of the
3854 first <script> tag in a the page, up to, and including, the text
3855 "document.referrer", if both are present in the page (and appear in that
3856 order).
3857
3858 But there's still more pattern to go. The next element, again enclosed in
3859 parentheses, is .*</script>. You already know what .* means, so the whole
3860 pattern translates to: Match from the start of the first <script> tag in a page
3861 to the end of the last <script> tag, provided that the text "document.referrer"
3862 appears somewhere in between.
3863
3864 This is still not the whole story, since we have ignored the options and the
3865 parentheses: The portions of the page matched by sub-patterns that are enclosed
3866 in parentheses, will be remembered and be available through the variables $1,
3867 $2, ... in the substitute. The U option switches to ungreedy matching, which
3868 means that the first .* in the pattern will only "eat up" all text in between "
3869 <script" and the first occurrence of "document.referrer", and that the second .
3870 * will only span the text up to the first "</script>" tag. Furthermore, the s
3871 option says that the match may span multiple lines in the page, and the g
3872 option again means that the substitution is global.
3873
3874 So, to summarize, the pattern means: Match all scripts that contain the text
3875 "document.referrer". Remember the parts of the script from (and including) the
3876 start tag up to (and excluding) the string "document.referrer" as $1, and the
3877 part following that string, up to and including the closing tag, as $2.
3878
3879 Now the pattern is deciphered, but wasn't this about substituting things? So
3880 lets look at the substitute: $1"Not Your Business!"$2 is easy to read: The text
3881 remembered as $1, followed by "Not Your Business!" (including the quotation
3882 marks!), followed by the text remembered as $2. This produces an exact copy of
3883 the original string, with the middle part (the "document.referrer") replaced by
3884 "Not Your Business!".
3885
3886 The whole job now reads: Replace "document.referrer" by "Not Your Business!"
3887 wherever it appears inside a <script> tag. Note that this job won't break
3888 JavaScript syntax, since both the original and the replacement are
3889 syntactically valid string objects. The script just won't have access to the
3890 referrer information anymore.
3891
3892 We'll show you two other jobs from the JavaScript taming department, but this
3893 time only point out the constructs of special interest:
3894
3895 # The status bar is for displaying link targets, not pointless blahblah        
3896 #                                                                              
3897 s/window\.status\s*=\s*(['"]).*?\1/dUmMy=1/ig                                  
3898
3899 \s stands for whitespace characters (space, tab, newline, carriage return, form
3900 feed), so that \s* means: "zero or more whitespace". The ? in .*? makes this
3901 matching of arbitrary text ungreedy. (Note that the U option is not set). The
3902 ['"] construct means: "a single or a double quote". Finally, \1 is a
3903 backreference to the first parenthesis just like $1 above, with the difference
3904 that in the pattern, a backslash indicates a backreference, whereas in the
3905 substitute, it's the dollar.
3906
3907 So what does this job do? It replaces assignments of single- or double-quoted
3908 strings to the "window.status" object with a dummy assignment (using a variable
3909 name that is hopefully odd enough not to conflict with real variables in
3910 scripts). Thus, it catches many cases where e.g. pointless descriptions are
3911 displayed in the status bar instead of the link target when you move your mouse
3912 over links.
3913
3914 # Kill OnUnload popups. Yummy. Test: http://www.zdnet.com/zdsubs/yahoo/tree/yfs.html 
3915 #                                                                                    
3916 s/(<body [^>]*)onunload(.*>)/$1never$2/iU                                            
3917
3918 Including the OnUnload event binding in the HTML DOM was a CRIME. When I close
3919 a browser window, I want it to close and die. Basta. This job replaces the
3920 "onunload" attribute in "<body>" tags with the dummy word never. Note that the
3921 i option makes the pattern matching case-insensitive. Also note that ungreedy
3922 matching alone doesn't always guarantee a minimal match: In the first
3923 parenthesis, we had to use [^>]* instead of .* to prevent the match from
3924 exceeding the <body> tag if it doesn't contain "OnUnload", but the page's
3925 content does.
3926
3927 The last example is from the fun department:
3928
3929 FILTER: fun Fun text replacements                                              
3930                                                                                
3931 # Spice the daily news:                                                        
3932 #                                                                              
3933 s/microsoft(?!\.com)/MicroSuck/ig                                              
3934
3935 Note the (?!\.com) part (a so-called negative lookahead) in the job's pattern,
3936 which means: Don't match, if the string ".com" appears directly following
3937 "microsoft" in the page. This prevents links to microsoft.com from being
3938 trashed, while still replacing the word everywhere else.
3939
3940 # Buzzword Bingo (example for extended regex syntax)                           
3941 #                                                                              
3942 s* industry[ -]leading \                                                       
3943 |  cutting[ -]edge \                                                           
3944 |  customer[ -]focused \                                                       
3945 |  market[ -]driven \                                                          
3946 |  award[ -]winning # Comments are OK, too! \                                  
3947 |  high[ -]performance \                                                       
3948 |  solutions[ -]based \                                                        
3949 |  unmatched \                                                                 
3950 |  unparalleled \                                                              
3951 |  unrivalled \                                                                
3952 *<font color="red"><b>BINGO!</b></font> \                                      
3953 *igx                                                                           
3954
3955 The x option in this job turns on extended syntax, and allows for e.g. the
3956 liberal use of (non-interpreted!) whitespace for nicer formatting.
3957
3958 You get the idea?
3959
3960 -------------------------------------------------------------------------------
3961
3962 10. Templates
3963
3964 All Privoxy built-in pages, i.e. error pages such as the "404 - No Such Domain"
3965 error page, the "BLOCKED" page and all pages of its web-based user interface,
3966 are generated from templates. (Privoxy must be running for the above links to
3967 work as intended.)
3968
3969 These templates are stored in a subdirectory of the configuration directory
3970 called templates. On Unixish platforms, this is typically /etc/privoxy/
3971 templates/.
3972
3973 The templates are basically normal HTML files, but with place-holders (called
3974 symbols or exports), which Privoxy fills at run time. You can edit the
3975 templates with a normal text editor, should you want to customize them. (Not
3976 recommended for the casual user). Note that just like in configuration files,
3977 lines starting with # are ignored when the templates are filled in.
3978
3979 The place-holders are of the form @name@, and you will find a list of available
3980 symbols, which vary from template to template, in the comments at the start of
3981 each file. Note that these comments are not always accurate, and that it's
3982 probably best to look at the existing HTML code to find out which symbols are
3983 supported and what they are filled in with.
3984
3985 A special application of this substitution mechanism is to make whole blocks of
3986 HTML code disappear when a specific symbol is set. We use this for many
3987 purposes, one of them being to include the beta warning in all our user
3988 interface (CGI) pages when Privoxy in in an alpha or beta development stage:
3989
3990 <!-- @if-unstable-start -->                                                    
3991                                                                                
3992   ... beta warning HTML code goes here ...                                     
3993                                                                                
3994 <!-- if-unstable-end@ -->                                                      
3995
3996 If the "unstable" symbol is set, everything in between and including
3997 @if-unstable-start and if-unstable-end@ will disappear, leaving nothing but an
3998 empty comment:
3999
4000 <!--  -->                                                                      
4001
4002 There's also an if-then-else construct and an #include mechanism, but you'll
4003 sure find out if you are inclined to edit the templates ;-)
4004
4005 All templates refer to a style located at http://config.privoxy.org/
4006 send-stylesheet. This is, of course, locally served by Privoxy and the source
4007 for it can be found and edited in the cgi-style.css template.
4008
4009 -------------------------------------------------------------------------------
4010
4011 11. Contacting the Developers, Bug Reporting and Feature Requests
4012
4013 We value your feedback. In fact, we rely on it to improve Privoxy and its
4014 configuration. However, please note the following hints, so we can provide you
4015 with the best support:
4016
4017 -------------------------------------------------------------------------------
4018
4019 11.1. Get Support
4020
4021 For casual users, our support forum at SourceForge is probably best suited: 
4022 http://sourceforge.net/tracker/?group_id=11118&atid=211118
4023
4024 All users are of course welcome to discuss their issues on the users mailing
4025 list, where the developers also hang around.
4026
4027 -------------------------------------------------------------------------------
4028
4029 11.2. Report Bugs
4030
4031 Please report all bugs only through our bug tracker: http://sourceforge.net/
4032 tracker/?group_id=11118&atid=111118.
4033
4034 Before doing so, please make sure that the bug has not already been submitted
4035 and observe the additional hints at the top of the submit form.
4036
4037 Please try to verify that it is a Privoxy bug, and not a browser or site bug
4038 first. If unsure, try toggling off Privoxy, and see if the problem persists.
4039 The appendix of the user manual also has helpful information on action
4040 debugging. If you are using your own custom configuration, please try the stock
4041 configs to see if the problem is configuration related.
4042
4043 If not using the latest version, chances are that the bug has been found and
4044 fixed in the meantime. We would appreciate if you could take the time to 
4045 upgrade to the latest version (or even the latest CVS snapshot) and verify your
4046 bug, but this is not required for reporting.
4047
4048 -------------------------------------------------------------------------------
4049
4050 11.3. Request New Features
4051
4052 You are welcome to submit ideas on new features or other proposals for
4053 improvement through our feature request tracker at http://sourceforge.net/
4054 tracker/?atid=361118&group_id=11118.
4055
4056 -------------------------------------------------------------------------------
4057
4058 11.4. Report Ads or Other Actions-Related Problems
4059
4060 Please send feedback on ads that slipped through, innocent images that were
4061 blocked, and any other problems relating to the default.action file through our
4062 actions feedback mechanism located at http://www.privoxy.org/actions/. On this
4063 page, you will also find a bookmark which will take you back there from any
4064 troubled site and even pre-fill the form!
4065
4066 New, improved default.action files will occasionally be made available based on
4067 your feedback. These will be announced on the ijbswa-announce list and
4068 available from our the files section of our project page.
4069
4070 -------------------------------------------------------------------------------
4071
4072 11.5. Other
4073
4074 For any other issues, feel free to use the mailing lists. Technically
4075 interested users and people who wish to contribute to the project are also
4076 welcome on the developers list! You can find an overview of all Privoxy-related
4077 mailing lists, including list archives, at: http://sourceforge.net/mail/?
4078 group_id=11118.
4079
4080 -------------------------------------------------------------------------------
4081
4082 12. Privoxy Copyright, License and History
4083
4084 Copyright © 2001, 2002 by Privoxy Developers <developers@privoxy.org>
4085
4086 Some source code is based on code Copyright © 1997 by Anonymous Coders and
4087 Junkbusters, Inc. and licensed under the GNU General Public License.
4088
4089 -------------------------------------------------------------------------------
4090
4091 12.1. License
4092
4093 Privoxy is free software; you can redistribute it and/or modify it under the
4094 terms of the GNU General Public License, version 2, as published by the Free
4095 Software Foundation.
4096
4097 This program is distributed in the hope that it will be useful, but WITHOUT ANY
4098 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
4099 PARTICULAR PURPOSE. See the GNU General Public License for more details, which
4100 is available from the Free Software Foundation, Inc, 59 Temple Place - Suite
4101 330, Boston, MA 02111-1307, USA.
4102
4103 You should have received a copy of the GNU General Public License along with
4104 this program; if not, write to the
4105
4106  Free Software
4107  Foundation, Inc. 59 Temple Place - Suite 330
4108  Boston, MA 02111-1307
4109  USA 
4110
4111 -------------------------------------------------------------------------------
4112
4113 12.2. History
4114
4115 In the beginning, there was the Internet Junkbuster, by Anonymous Coders and 
4116 Junkbusters Corporation. It saved many users a lot of pain in the early days of
4117 web advertising and user tracking.
4118
4119 But the web, its protocols and standards, and with it, the techniques for
4120 forcing users to consume ads, give up autonomy over their browsing, and for
4121 spying on them, kept evolving. Unfortunately, the Internet Junkbuster did not.
4122 Version 2.0.2, published in 1998, was (and is) the last official release
4123 available from Junkbusters Corporation. Fortunately, it had been released under
4124 the GNU GPL, which allowed further development by others.
4125
4126 So Stefan Waldherr started maintaining an improved version of the software, to
4127 which eventually a number of people contributed patches. It could already
4128 replace banners with a transparent image, and had a first version of pop-up
4129 killing, but it was still very closely based on the original, with all its
4130 limitations, such as the lack of HTTP/1.1 support, flexible per-site
4131 configuration, or content modification. The last release from this effort was
4132 version 2.0.2-10, published in 2000.
4133
4134 Then, some developers picked up the thread, and started turning the software
4135 inside out, upside down, and then reassembled it, adding many new features
4136 along the way.
4137
4138 The result of this is Privoxy, whose first stable release, 3.0, was released
4139 August, 2002.
4140
4141 -------------------------------------------------------------------------------
4142
4143 12.3. Authors
4144
4145 Current Project Developers:
4146
4147  Jon Foster
4148  Andreas Oesterhelt
4149  Stefan Waldherr
4150  
4151  Thomas Steudten
4152  Rodney Stromlund
4153
4154 Current Project Contributors:
4155
4156  Johny Agotnes 
4157  Rodrigo Barbosa (RPM specfiles)
4158  Moritz Barsnick
4159  Hal Burgiss (docs)
4160  Mattes Dolak 
4161  Karsten Hopp (Red Hat)
4162  Alexander Lazic
4163  Daniel Leite
4164  Gábor Lipták
4165  Andrew Lock (Win32)
4166  Guy Laroche
4167  Haroon Rafique
4168  Roland Rosenfeld (Debian)
4169  Georg Sauthoff (Gentoo)
4170  David Schmidt (OS/2, Mac OSX ports)
4171  Joerg Strohmayer (Amiga)
4172  Sviatoslav Sviridov
4173  Sarantis Paskalis
4174
4175 Based in part on code originally developed by:
4176
4177  Junkbusters Corp.
4178  Anonymous Coders
4179
4180 Thanks to the many people who have tested Privoxy, reported bugs, or made
4181 suggestions. These include (in alphabetical order):
4182
4183  Ken Arromdee
4184  Devin Bayer
4185  Reiner Buehl
4186  Andrew J. Caines
4187  Clifford Caoile
4188  Michael T. Davis
4189  Brian Dessent
4190  Peter E
4191  Aaron Hamid
4192  Magnus Holmgren
4193  Don Libes  
4194  Paul Lieverse
4195  David Mediavilla 
4196  Oliver Stoeneberg
4197  Roberto Ragusa
4198  Maynard Riley
4199  Bart Schelstraete
4200  Darren Wiebe
4201  Jamie Zawinski
4202
4203 -------------------------------------------------------------------------------
4204
4205 13. See Also
4206
4207 Other references and sites of interest to Privoxy users:
4208
4209 http://www.privoxy.org/, the Privoxy Home page.
4210
4211 http://www.privoxy.org/faq/, the Privoxy FAQ.
4212
4213 http://sourceforge.net/projects/ijbswa/, the Project Page for Privoxy on       
4214 SourceForge.                                                                   
4215
4216 http://config.privoxy.org/, the web-based user interface. Privoxy must be      
4217 running for this to work. Shortcut: http://p.p/                                
4218
4219 http://www.privoxy.org/actions/, to submit "misses" to the developers.
4220
4221 http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/ijbswa/contrib/, cool and fun   
4222 ideas from Privoxy users.                                                      
4223
4224 http://www.junkbusters.com/ht/en/cookies.html, an explanation how cookies are  
4225 used to track web users.                                                       
4226
4227 http://www.junkbusters.com/ijb.html, the original Internet Junkbuster.
4228
4229 http://www.waldherr.org/junkbuster/, Stefan Waldherr's version of Junkbuster,  
4230 from which Privoxy was derived.                                                
4231
4232 http://privacy.net/analyze/, a useful site to check what information about you 
4233 is leaked while you browse the web.                                            
4234
4235 http://www.squid-cache.org/, a very popular caching proxy, which is often used 
4236 together with Privoxy.                                                         
4237
4238 http://www.privoxy.org/developer-manual/, the Privoxy developer manual.
4239
4240 -------------------------------------------------------------------------------
4241
4242 14. Appendix
4243
4244 14.1. Regular Expressions
4245
4246 Privoxy uses Perl-style "regular expressions" in its actions files and filter
4247 file, through the PCRE and PCRS libraries.
4248
4249 If you are reading this, you probably don't understand what "regular
4250 expressions" are, or what they can do. So this will be a very brief
4251 introduction only. A full explanation would require a book ;-)
4252
4253 Regular expressions provide a language to describe patterns that can be run
4254 against strings of characters (letter, numbers, etc), to see if they match the
4255 string or not. The patterns are themselves (sometimes complex) strings of
4256 literal characters, combined with wild-cards, and other special characters,
4257 called meta-characters. The "meta-characters" have special meanings and are
4258 used to build complex patterns to be matched against. Perl Compatible Regular
4259 Expressions are an especially convenient "dialect" of the regular expression
4260 language.
4261
4262 To make a simple analogy, we do something similar when we use wild-card
4263 characters when listing files with the dir command in DOS. *.* matches all
4264 filenames. The "special" character here is the asterisk which matches any and
4265 all characters. We can be more specific and use ? to match just individual
4266 characters. So "dir file?.text" would match "file1.txt", "file2.txt", etc. We
4267 are pattern matching, using a similar technique to "regular expressions"!
4268
4269 Regular expressions do essentially the same thing, but are much, much more
4270 powerful. There are many more "special characters" and ways of building complex
4271 patterns however. Let's look at a few of the common ones, and then some
4272 examples:
4273
4274 . - Matches any single character, e.g. "a", "A", "4", ":", or "@".
4275
4276 ? - The preceding character or expression is matched ZERO or ONE times. Either/
4277 or.                                                                            
4278
4279 + - The preceding character or expression is matched ONE or MORE times.
4280
4281 * - The preceding character or expression is matched ZERO or MORE times.
4282
4283 \ - The "escape" character denotes that the following character should be taken
4284 literally. This is used where one of the special characters (e.g. ".") needs to
4285 be taken literally and not as a special meta-character. Example: "example      
4286 \.com", makes sure the period is recognized only as a period (and not expanded 
4287 to its meta-character meaning of any single character).                        
4288
4289 [] - Characters enclosed in brackets will be matched if any of the enclosed    
4290 characters are encountered. For instance, "[0-9]" matches any numeric digit    
4291 (zero through nine). As an example, we can combine this with "+" to match any  
4292 digit one of more times: "[0-9]+".                                             
4293
4294 () - parentheses are used to group a sub-expression, or multiple               
4295 sub-expressions.                                                               
4296
4297 | - The "bar" character works like an "or" conditional statement. A match is   
4298 successful if the sub-expression on either side of "|" matches. As an example: 
4299 "/(this|that) example/" uses grouping and the bar character and would match    
4300 either "this example" or "that example", and nothing else.                     
4301
4302 These are just some of the ones you are likely to use when matching URLs with
4303 Privoxy, and is a long way from a definitive list. This is enough to get us
4304 started with a few simple examples which may be more illuminating:
4305
4306 /.*/banners/.* - A simple example that uses the common combination of "." and "
4307 *" to denote any character, zero or more times. In other words, any string at
4308 all. So we start with a literal forward slash, then our regular expression
4309 pattern (".*") another literal forward slash, the string "banners", another
4310 forward slash, and lastly another ".*". We are building a directory path here.
4311 This will match any file with the path that has a directory named "banners" in
4312 it. The ".*" matches any characters, and this could conceivably be more forward
4313 slashes, so it might expand into a much longer looking path. For example, this
4314 could match: "/eye/hate/spammers/banners/annoy_me_please.gif", or just "/
4315 banners/annoying.html", or almost an infinite number of other possible
4316 combinations, just so it has "banners" in the path somewhere.
4317
4318 A now something a little more complex:
4319
4320 /.*/adv((er)?ts?|ertis(ing|ements?))?/ - We have several literal forward
4321 slashes again ("/"), so we are building another expression that is a file path
4322 statement. We have another ".*", so we are matching against any conceivable
4323 sub-path, just so it matches our expression. The only true literal that must
4324 match our pattern is adv, together with the forward slashes. What comes after
4325 the "adv" string is the interesting part.
4326
4327 Remember the "?" means the preceding expression (either a literal character or
4328 anything grouped with "(...)" in this case) can exist or not, since this means
4329 either zero or one match. So "((er)?ts?|ertis(ing|ements?))" is optional, as
4330 are the individual sub-expressions: "(er)", "(ing|ements?)", and the "s". The "
4331 |" means "or". We have two of those. For instance, "(ing|ements?)", can expand
4332 to match either "ing" OR "ements?". What is being done here, is an attempt at
4333 matching as many variations of "advertisement", and similar, as possible. So
4334 this would expand to match just "adv", or "advert", or "adverts", or
4335 "advertising", or "advertisement", or "advertisements". You get the idea. But
4336 it would not match "advertizements" (with a "z"). We could fix that by changing
4337 our regular expression to: "/.*/adv((er)?ts?|erti(s|z)(ing|ements?))?/", which
4338 would then match either spelling.
4339
4340 /.*/advert[0-9]+\.(gif|jpe?g) - Again another path statement with forward
4341 slashes. Anything in the square brackets "[]" can be matched. This is using
4342 "0-9" as a shorthand expression to mean any digit one through nine. It is the
4343 same as saying "0123456789". So any digit matches. The "+" means one or more of
4344 the preceding expression must be included. The preceding expression here is
4345 what is in the square brackets -- in this case, any digit one through nine.
4346 Then, at the end, we have a grouping: "(gif|jpe?g)". This includes a "|", so
4347 this needs to match the expression on either side of that bar character also. A
4348 simple "gif" on one side, and the other side will in turn match either "jpeg"
4349 or "jpg", since the "?" means the letter "e" is optional and can be matched
4350 once or not at all. So we are building an expression here to match image GIF or
4351 JPEG type image file. It must include the literal string "advert", then one or
4352 more digits, and a "." (which is now a literal, and not a special character,
4353 since it is escaped with "\"), and lastly either "gif", or "jpeg", or "jpg".
4354 Some possible matches would include: "//advert1.jpg", "/nasty/ads/
4355 advert1234.gif", "/banners/from/hell/advert99.jpg". It would not match
4356 "advert1.gif" (no leading slash), or "/adverts232.jpg" (the expression does not
4357 include an "s"), or "/advert1.jsp" ("jsp" is not in the expression anywhere).
4358
4359 We are barely scratching the surface of regular expressions here so that you
4360 can understand the default Privoxy configuration files, and maybe use this
4361 knowledge to customize your own installation. There is much, much more that can
4362 be done with regular expressions. Now that you know enough to get started, you
4363 can learn more on your own :/
4364
4365 More reading on Perl Compatible Regular expressions: http://www.perldoc.com/
4366 perl5.6/pod/perlre.html
4367
4368 For information on regular expression based substitutions and their
4369 applications in filters, please see the filter file tutorial in this manual.
4370
4371 -------------------------------------------------------------------------------
4372
4373 14.2. Privoxy's Internal Pages
4374
4375 Since Privoxy proxies each requested web page, it is easy for Privoxy to trap
4376 certain special URLs. In this way, we can talk directly to Privoxy, and see how
4377 it is configured, see how our rules are being applied, change these rules and
4378 other configuration options, and even turn Privoxy's filtering off, all with a
4379 web browser. 
4380
4381 The URLs listed below are the special ones that allow direct access to Privoxy.
4382 Of course, Privoxy must be running to access these. If not, you will get a
4383 friendly error message. Internet access is not necessary either.
4384
4385   * Privoxy main page:
4386    
4387         http://config.privoxy.org/
4388        
4389     There is a shortcut: http://p.p/ (But it doesn't provide a fall-back to a
4390     real page, in case the request is not sent through Privoxy)
4391    
4392   * Show information about the current configuration, including viewing and
4393     editing of actions files:
4394    
4395         http://config.privoxy.org/show-status
4396        
4397   * Show the source code version numbers:
4398    
4399         http://config.privoxy.org/show-version
4400        
4401   * Show the browser's request headers:
4402    
4403         http://config.privoxy.org/show-request
4404        
4405   * Show which actions apply to a URL and why:
4406    
4407         http://config.privoxy.org/show-url-info
4408        
4409   * Toggle Privoxy on or off. In this case, "Privoxy" continues to run, but
4410     only as a pass-through proxy, with no actions taking place:
4411    
4412         http://config.privoxy.org/toggle
4413        
4414     Short cuts. Turn off, then on:
4415    
4416         http://config.privoxy.org/toggle?set=disable
4417        
4418         http://config.privoxy.org/toggle?set=enable
4419        
4420 These may be bookmarked for quick reference. See next. 
4421
4422 -------------------------------------------------------------------------------
4423
4424 14.2.1. Bookmarklets
4425
4426 Below are some "bookmarklets" to allow you to easily access a "mini" version of
4427 some of Privoxy's special pages. They are designed for MS Internet Explorer,
4428 but should work equally well in Netscape, Mozilla, and other browsers which
4429 support JavaScript. They are designed to run directly from your bookmarks - not
4430 by clicking the links below (although that should work for testing).
4431
4432 To save them, right-click the link and choose "Add to Favorites" (IE) or "Add
4433 Bookmark" (Netscape). You will get a warning that the bookmark "may not be
4434 safe" - just click OK. Then you can run the Bookmarklet directly from your
4435 favorites/bookmarks. For even faster access, you can put them on the "Links"
4436 bar (IE) or the "Personal Toolbar" (Netscape), and run them with a single
4437 click.
4438
4439   * Privoxy - Enable
4440    
4441   * Privoxy - Disable
4442    
4443   * Privoxy - Toggle Privoxy (Toggles between enabled and disabled)
4444    
4445   * Privoxy- View Status
4446    
4447   * Privoxy - Submit Actions File Feedback
4448    
4449   * Privoxy - Why?
4450    
4451 Credit: The site which gave us the general idea for these bookmarklets is 
4452 www.bookmarklets.com. They have more information about bookmarklets.
4453
4454 -------------------------------------------------------------------------------
4455
4456 14.3. Chain of Events
4457
4458 Let's take a quick look at the basic sequence of events when a web page is
4459 requested by your browser and Privoxy is on duty:
4460
4461   * First, your web browser requests a web page. The browser knows to send the
4462     request to Privoxy, which will in turn, relay the request to the remote web
4463     server after passing the following tests:
4464    
4465   * Privoxy traps any request for its own internal CGI pages (e.g http://p.p/)
4466     and sends the CGI page back to the browser.
4467    
4468   * Next, Privoxy checks to see if the URL matches any "+block" patterns. If
4469     so, the URL is then blocked, and the remote web server will not be
4470     contacted. "+handle-as-image" is then checked and if it does not match, an
4471     HTML "BLOCKED" page is sent back. Otherwise, if it does match, an image is
4472     returned. The type of image depends on the setting of "+set-image-blocker"
4473     (blank, checkerboard pattern, or an HTTP redirect to an image elsewhere).
4474    
4475   * Untrusted URLs are blocked. If URLs are being added to the trust file, then
4476     that is done.
4477    
4478   * If the URL pattern matches the "+fast-redirects" action, it is then
4479     processed. Unwanted parts of the requested URL are stripped.
4480    
4481   * Now the rest of the client browser's request headers are processed. If any
4482     of these match any of the relevant actions (e.g. "+hide-user-agent", etc.),
4483     headers are suppressed or forged as determined by these actions and their
4484     parameters.
4485    
4486   * Now the web server starts sending its response back (i.e. typically a web
4487     page and related data).
4488    
4489   * First, the server headers are read and processed to determine, among other
4490     things, the MIME type (document type) and encoding. The headers are then
4491     filtered as determined by the "+crunch-incoming-cookies", 
4492     "+session-cookies-only", and "+downgrade-http-version" actions.
4493    
4494   * If the "+kill-popups" action applies, and it is an HTML or JavaScript
4495     document, the popup-code in the response is filtered on-the-fly as it is
4496     received.
4497    
4498   * If a "+filter" or "+deanimate-gifs" action applies (and the document type
4499     fits the action), the rest of the page is read into memory (up to a
4500     configurable limit). Then the filter rules (from default.filter) are
4501     processed against the buffered content. Filters are applied in the order
4502     they are specified in the default.filter file. Animated GIFs, if present,
4503     are reduced to either the first or last frame, depending on the action
4504     setting.The entire page, which is now filtered, is then sent by Privoxy
4505     back to your browser.
4506    
4507     If neither "+filter" or "+deanimate-gifs" matches, then Privoxy passes the
4508     raw data through to the client browser as it becomes available.
4509    
4510   * As the browser receives the now (probably filtered) page content, it reads
4511     and then requests any URLs that may be embedded within the page source,
4512     e.g. ad images, stylesheets, JavaScript, other HTML documents (e.g.
4513     frames), sounds, etc. For each of these objects, the browser issues a new
4514     request. And each such request is in turn processed as above. Note that a
4515     complex web page may have many such embedded URLs.
4516    
4517 -------------------------------------------------------------------------------
4518
4519 14.4. Anatomy of an Action
4520
4521 The way Privoxy applies actions and filters to any given URL can be complex,
4522 and not always so easy to understand what is happening. And sometimes we need
4523 to be able to see just what Privoxy is doing. Especially, if something Privoxy
4524 is doing is causing us a problem inadvertently. It can be a little daunting to
4525 look at the actions and filters files themselves, since they tend to be filled
4526 with regular expressions whose consequences are not always so obvious.
4527
4528 One quick test to see if Privoxy is causing a problem or not, is to disable it
4529 temporarily. This should be the first troubleshooting step. See the
4530 Bookmarklets section on a quick and easy way to do this (be sure to flush
4531 caches afterward!). Looking at the logs is a good idea too.
4532
4533 Privoxy also provides the http://config.privoxy.org/show-url-info page that can
4534 show us very specifically how actions are being applied to any given URL. This
4535 is a big help for troubleshooting.
4536
4537 First, enter one URL (or partial URL) at the prompt, and then Privoxy will tell
4538 us how the current configuration will handle it. This will not help with
4539 filtering effects (i.e. the "+filter" action) from the default.filter file
4540 since this is handled very differently and not so easy to trap! It also will
4541 not tell you about any other URLs that may be embedded within the URL you are
4542 testing. For instance, images such as ads are expressed as URLs within the raw
4543 page source of HTML pages. So you will only get info for the actual URL that is
4544 pasted into the prompt area -- not any sub-URLs. If you want to know about
4545 embedded URLs like ads, you will have to dig those out of the HTML source. Use
4546 your browser's "View Page Source" option for this. Or right click on the ad,
4547 and grab the URL.
4548
4549 Let's try an example, google.com, and look at it one section at a time:
4550
4551  Matches for http://google.com:                                                
4552                                                                                
4553  In file: default.action [ View ] [ Edit ]                                     
4554                                                                                
4555 {-add-header                                                                   
4556  -block                                                                        
4557  -crunch-outgoing-cookies                                                      
4558  -crunch-incoming-cookies                                                      
4559  +deanimate-gifs{last}                                                         
4560  -downgrade-http-version                                                       
4561  +fast-redirects                                                               
4562  -filter{popups}                                                               
4563  -filter{fun}                                                                  
4564  -filter{shockwave-flash}                                                      
4565  -filter{crude-parental}                                                       
4566  +filter{html-annoyances}                                                      
4567  +filter{js-annoyances}                                                        
4568  +filter{content-cookies}                                                      
4569  +filter{webbugs}                                                              
4570  +filter{refresh-tags}                                                         
4571  +filter{nimda}                                                                
4572  +filter{banners-by-size}                                                      
4573  +hide-forwarded-for-headers                                                   
4574  +hide-from-header{block}                                                      
4575  +hide-referer{forge}                                                          
4576  -hide-user-agent                                                              
4577  -handle-as-image                                                              
4578  -kill-popups                                                                  
4579  -limit-connect                                                                
4580  +prevent-compression                                                          
4581  -send-vanilla-wafer                                                           
4582  -send-wafer                                                                   
4583  +session-cookies-only                                                         
4584  +set-image-blocker{pattern} }                                                 
4585 /                                                                              
4586                                                                                
4587  { -session-cookies-only }                                                     
4588  .google.com                                                                   
4589                                                                                
4590  { -fast-redirects }                                                           
4591  .google.com                                                                   
4592                                                                                
4593 In file: user.action [ View ] [ Edit ]                                         
4594 (no matches in this file)                                                      
4595
4596 This tells us how we have defined our "actions", and which ones match for our
4597 example, "google.com". The first listing is any matches for the standard.action
4598 file. No hits at all here on "standard". Then next is "default", or our
4599 default.action file. The large, multi-line listing, is how the actions are set
4600 to match for all URLs, i.e. our default settings. If you look at your "actions"
4601 file, this would be the section just below the "aliases" section near the top.
4602 This will apply to all URLs as signified by the single forward slash at the end
4603 of the listing -- "/".
4604
4605 But we can define additional actions that would be exceptions to these general
4606 rules, and then list specific URLs (or patterns) that these exceptions would
4607 apply to. Last match wins. Just below this then are two explicit matches for
4608 ".google.com". The first is negating our previous cookie setting, which was for
4609 "+session-cookies-only" (i.e. not persistent). So we will allow persistent
4610 cookies for google. The second turns off any "+fast-redirects" action, allowing
4611 this to take place unmolested. Note that there is a leading dot here --
4612 ".google.com". This will match any hosts and sub-domains, in the google.com
4613 domain also, such as "www.google.com". So, apparently, we have these two
4614 actions defined somewhere in the lower part of our default.action file, and
4615 "google.com" is referenced somewhere in these latter sections.
4616
4617 Then, for our user.action file, we again have no hits.
4618
4619 And finally we pull it all together in the bottom section and summarize how
4620 Privoxy is applying all its "actions" to "google.com": 
4621
4622  Final results:                                                                
4623                                                                                
4624  -add-header                                                                   
4625  -block                                                                        
4626  -crunch-outgoing-cookies                                                      
4627  -crunch-incoming-cookies                                                      
4628  +deanimate-gifs{last}                                                         
4629  -downgrade-http-version                                                       
4630  -fast-redirects                                                               
4631  -filter{popups}                                                               
4632  -filter{fun}                                                                  
4633  -filter{shockwave-flash}                                                      
4634  -filter{crude-parental}                                                       
4635  +filter{html-annoyances}                                                      
4636  +filter{js-annoyances}                                                        
4637  +filter{content-cookies}                                                      
4638  +filter{webbugs}                                                              
4639  +filter{refresh-tags}                                                         
4640  +filter{nimda}                                                                
4641  +filter{banners-by-size}                                                      
4642  +hide-forwarded-for-headers                                                   
4643  +hide-from-header{block}                                                      
4644  +hide-referer{forge}                                                          
4645  -hide-user-agent                                                              
4646  -handle-as-image                                                              
4647  -kill-popups                                                                  
4648  -limit-connect                                                                
4649  +prevent-compression                                                          
4650  -send-vanilla-wafer                                                           
4651  -send-wafer                                                                   
4652  -session-cookies-only                                                         
4653  +set-image-blocker{pattern}                                                   
4654
4655 Notice the only difference here to the previous listing, is to "fast-redirects"
4656 and "session-cookies-only".
4657
4658 Now another example, "ad.doubleclick.net":
4659
4660  { +block +handle-as-image }                                                   
4661   .ad.doubleclick.net                                                          
4662                                                                                
4663  { +block +handle-as-image }                                                   
4664   ad*.                                                                         
4665                                                                                
4666  { +block +handle-as-image }                                                   
4667   .doubleclick.net                                                             
4668
4669 We'll just show the interesting part here, the explicit matches. It is matched
4670 three different times. Each as an "+block +handle-as-image", which is the
4671 expanded form of one of our aliases that had been defined as: "+imageblock". (
4672 "Aliases" are defined in the first section of the actions file and typically
4673 used to combine more than one action.)
4674
4675 Any one of these would have done the trick and blocked this as an unwanted
4676 image. This is unnecessarily redundant since the last case effectively would
4677 also cover the first. No point in taking chances with these guys though ;-)
4678 Note that if you want an ad or obnoxious URL to be invisible, it should be
4679 defined as "ad.doubleclick.net" is done here -- as both a "+block" and an 
4680 "+handle-as-image". The custom alias "+imageblock" just simplifies the process
4681 and make it more readable.
4682
4683 One last example. Let's try "http://www.rhapsodyk.net/adsl/HOWTO/". This one is
4684 giving us problems. We are getting a blank page. Hmmm ...
4685
4686  Matches for http://www.rhapsodyk.net/adsl/HOWTO/:                             
4687                                                                                
4688  In file: default.action [ View ] [ Edit ]                                     
4689                                                                                
4690  {-add-header                                                                  
4691   -block                                                                       
4692   -crunch-incoming-cookies                                                     
4693   -crunch-outgoing-cookies                                                     
4694   +deanimate-gifs                                                              
4695   -downgrade-http-version                                                      
4696   +fast-redirects                                                              
4697   +filter{html-annoyances}                                                     
4698   +filter{js-annoyances}                                                       
4699   +filter{kill-popups}                                                         
4700   +filter{webbugs}                                                             
4701   +filter{nimda}                                                               
4702   +filter{banners-by-size}                                                     
4703   +filter{hal}                                                                 
4704   +filter{fun}                                                                 
4705   +hide-forwarded-for-headers                                                  
4706   +hide-from-header{block}                                                     
4707   +hide-referer{forge}                                                         
4708   -hide-user-agent                                                             
4709   -handle-as-image                                                             
4710   +kill-popups                                                                 
4711   +prevent-compression                                                         
4712   -send-vanilla-wafer                                                          
4713   -send-wafer                                                                  
4714   +session-cookies-only                                                        
4715   +set-image-blocker{blank} }                                                  
4716    /                                                                           
4717                                                                                
4718  { +block +handle-as-image }                                                   
4719   /ads                                                                         
4720
4721 Ooops, the "/adsl/" is matching "/ads"! But we did not want this at all! Now we
4722 see why we get the blank page. We could now add a new action below this that
4723 explicitly does not block ("{-block}") paths with "adsl". There are various
4724 ways to handle such exceptions. Example:
4725
4726  { -block }                                                                    
4727   /adsl                                                                        
4728
4729 Now the page displays ;-) Be sure to flush your browser's caches when making
4730 such changes. Or, try using Shift+Reload.
4731
4732 But now what about a situation where we get no explicit matches like we did
4733 with:
4734
4735  { +block +handle-as-image }                                                   
4736  /ads                                                                          
4737
4738 That actually was very telling and pointed us quickly to where the problem was.
4739 If you don't get this kind of match, then it means one of the default rules in
4740 the first section is causing the problem. This would require some guesswork,
4741 and maybe a little trial and error to isolate the offending rule. One likely
4742 cause would be one of the "{+filter}" actions. These tend to be harder to
4743 troubleshoot. Try adding the URL for the site to one of aliases that turn off
4744 "+filter":
4745
4746  {shop}                                                                        
4747  .quietpc.com                                                                  
4748  .worldpay.com   # for quietpc.com                                             
4749  .jungle.com                                                                   
4750  .scan.co.uk                                                                   
4751  .forbes.com                                                                   
4752
4753 "{shop}" is an "alias" that expands to "{ -filter -session-cookies-only }". Or
4754 you could do your own exception to negate filtering: 
4755
4756  {-filter}                                                                     
4757  .forbes.com                                                                   
4758
4759 This would turn off all filtering for that site. This would probably be most
4760 appropriately put in user.action, for local site exceptions.
4761
4762 Images that are inexplicably being blocked, may well be hitting the "+filter
4763 {banners-by-size}" rule, which assumes that images of certain sizes are ad
4764 banners (works well most of the time since these tend to be standardized).
4765
4766 "{fragile}" is an alias that disables most actions. This can be used as a last
4767 resort for problem sites. Remember to flush caches! If this still does not
4768 work, you will have to go through the remaining actions one by one to find
4769 which one(s) is causing the problem.
4770