generated
[privoxy.git] / doc / text / user-manual.txt
1 Privoxy User Manual
2
3 By: Privoxy Developers
4
5 $Id: user-manual.sgml,v 1.91 2002/04/24 02:39:31 hal9 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  
26 1. Introduction
27    
28     1.1. New Features
29    
30 3. Installation
31    
32     3.1. Binary Packages
33        
34         3.1.1. Red Hat and SuSE RPMs
35         3.1.2. Debian
36         3.1.3. Windows
37         3.1.4. Solaris, NetBSD, FreeBSD, HP-UX
38         3.1.5. OS/2
39         3.1.6. Max OSX
40         3.1.7. AmigaOS
41        
42     3.2. Building from Source
43    
44 4. Quickstart to Using Privoxy
45    
46     4.1. Note to Upgraders
47     4.2. Starting Privoxy
48     4.3. Command Line Options
49    
50 5. Privoxy Configuration
51    
52     5.1. Controlling Privoxy with Your Web Browser
53     5.2. Configuration Files Overview
54     5.3. The Main Configuration File
55        
56         5.3.1. Configuration and Log File Locations
57         5.3.2. Local Set-up Documentation
58         5.3.3. Debugging
59         5.3.4. Access Control and Security
60         5.3.5. Forwarding
61         5.3.6. Windows GUI Options
62        
63     5.4. The Actions File
64        
65         5.4.1. Finding the Right Mix
66         5.4.2. How to Edit
67         5.4.3. How Actions are Applied to URLs
68         5.4.4. Patterns
69         5.4.5. Actions
70         5.4.6. Aliases
71        
72     5.5. The Filter File
73     5.6. Templates
74    
75 6. Contacting the Developers, Bug Reporting and Feature Requests
76    
77     6.1. Submitting Ads and "Action" Problems
78    
79 7. Copyright and History
80    
81     7.1. Copyright
82     7.2. History
83    
84 8. See Also
85 9. Appendix
86    
87     9.1. Regular Expressions
88     9.2. Privoxy's Internal Pages
89        
90         9.2.1. Bookmarklets
91        
92     9.3. Chain of Events
93     9.4. Anatomy of an Action
94    
95 -------------------------------------------------------------------------------
96
97 1. Introduction
98
99 This documentation is included with the current beta version of Privoxy,
100 v.2.9.14, and is mostly complete at this point. The most up to date reference
101 for the time being is still the comments in the source files and in the
102 individual configuration files. Development of version 3.0 is currently nearing
103 completion, and includes many significant changes and enhancements over earlier
104 versions. The target release date for stable v3.0 is "soon" ;-).
105
106 Since this is a beta version, not all new features are well tested. This
107 documentation may be slightly out of sync as a result (especially with CVS
108 sources). And there may be bugs, though hopefully not many!
109
110 -------------------------------------------------------------------------------
111
112 1.1. New Features
113
114 In addition to Internet Junkbuster's traditional features of ad and banner
115 blocking and cookie management, Privoxy provides new features, some of them
116 currently under development:
117
118   * Integrated browser based configuration and control utility at http://
119     config.privoxy.org/ (shortcut: http://p.p/). Browser-based tracing of rule
120     and filter effects. Remote toggling.
121    
122   * Blocking of annoying pop-up browser windows.
123    
124   * HTTP/1.1 compliant (but not all optional 1.1 features are supported).
125    
126   * Support for Perl Compatible Regular Expressions in the configuration files,
127     and generally a more sophisticated and flexible configuration syntax over
128     previous versions.
129    
130   * GIF de-animation.
131    
132   * Web page content filtering (removes banners based on size, invisible
133     "web-bugs", JavaScript and HTML annoyances, pop-ups, etc.)
134    
135   * Bypass many click-tracking scripts (avoids script redirection).
136    
137   * Multi-threaded (POSIX and native threads).
138    
139   * Auto-detection and re-reading of config file changes.
140    
141   * User-customizable HTML templates (e.g. 404 error page).
142    
143   * Improved cookie management features (e.g. session based cookies).
144    
145   * Improved signal handling, and a true daemon mode (Unix).
146    
147   * Builds from source on most UNIX-like systems. Packages available for: Linux
148     (RedHat, SuSE, or Debian), Windows, Sun Solaris, Mac OSX, OS/2, HP-UX 11,
149     NetBSD and AmigaOS.
150    
151   * Every feature now controllable on a per-site or per-location basis,
152     configuration more powerful and versatile over-all.
153    
154   * Many smaller new features added, limitations and bugs removed, and security
155     holes fixed.
156    
157 -------------------------------------------------------------------------------
158
159 3. Installation
160
161 Privoxy is available both in convenient pre-compiled packages for a wide range
162 of operating systems, and as raw source code. For most users, we recommend
163 using the packages, which can be downloaded from our Privoxy Project Page.
164
165 If you like to live on the bleeding edge and are not afraid of using possibly
166 unstable development versions, you can check out the up-to-the-minute version
167 directly from the CVS repository or simply download the nightly CVS tarball.
168
169 At present, Privoxy is known to run on Win32, Mac OSX, OS/2, AmigaOS, Linux
170 (RedHat, Suse, Debian), FreeBSD, NetBSD, BeOS, and many flavors of Unix.
171
172 -------------------------------------------------------------------------------
173
174 3.1. Binary Packages
175
176 Note: If you have a previous Junkbuster or Privoxy installation on your system,
177 you will need to remove it. Some platforms do this for you as part of their
178 installation procedure. (See below for your platform).
179
180 In any case be sure to backup your old configuration if it is valuable to you.
181 See the note to upgraders.
182
183 How to install the binary packages depends on your operating system:
184
185 -------------------------------------------------------------------------------
186
187 3.1.1. Red Hat and SuSE RPMs
188
189 RPMs can be installed with rpm -Uvh privoxy-2.9.14-1.rpm, and will use /etc/
190 privoxy for the location of configuration files.
191
192 Note that on Red Hat, Privoxy will not be automatically started on system boot.
193 You will need to enable that using chkconfig, ntsysv, or similar method.
194
195 If you have problems with failed dependencies, try rebuilding the SRC RPM: rpm
196 --rebuild privoxy-2.9.14-1.src.rpm;. This will use your locally installed
197 libraries and RPM version.
198
199 Also note that if you have a Junkbuster RPM installed on your system, you need
200 to remove it first, because the packages conflict. Otherwise, RPM will try to
201 remove Junkbuster automatically, before installing Privoxy.
202
203 -------------------------------------------------------------------------------
204
205 3.1.2. Debian
206
207 FIXME.
208
209 -------------------------------------------------------------------------------
210
211 3.1.3. Windows
212
213 Just double-click the installer, which will guide you through the installation
214 process.
215
216 -------------------------------------------------------------------------------
217
218 3.1.4. Solaris, NetBSD, FreeBSD, HP-UX
219
220 Create a new directory, cd to it, then unzip and untar the archive. For the
221 most part, you'll have to figure out where things go. FIXME.
222
223 -------------------------------------------------------------------------------
224
225 3.1.5. OS/2
226
227 First, make sure that no previous installations of Junkbuster and / or Privoxy
228 are left on your system. You can do this by
229
230 Then, just double-click the WarpIN self-installing archive, which will guide
231 you through the installation process. A shadow of the Privoxy executable will
232 be placed in your startup folder so it will start automatically whenever OS/2
233 starts.
234
235 The directory you choose to install Privoxy into will contain all of the
236 configuration files.
237
238 -------------------------------------------------------------------------------
239
240 3.1.6. Max OSX
241
242 Unzip the downloaded package (you can either double-click on the file in the
243 finder, or on the desktop if you downloaded it there). Then, double-click on
244 the package installer icon and follow the installation process. Privoxy will be
245 installed in the subdirectory /Applications/Privoxy.app. Privoxy will set
246 itself up to start automatically on system bringup via /System/Library/
247 StartupItems/Privoxy.
248
249 -------------------------------------------------------------------------------
250
251 3.1.7. AmigaOS
252
253 Copy and then unpack the lha archive to a suitable location. All necessary
254 files will be installed into Privoxy directory, including all configuration and
255 log files. To uninstall, just remove this directory.
256
257 Start Privoxy (with RUN <>NIL:) in your startnet script (AmiTCP), in s:
258 user-startup (RoadShow), as startup program in your startup script (Genesis),
259 or as startup action (Miami and MiamiDx). Privoxy will automatically quit when
260 you quit your TCP/IP stack (just ignore the harmless warning your TCP/IP stack
261 may display that Privoxy is still running).
262
263 -------------------------------------------------------------------------------
264
265 3.2. Building from Source
266
267 To build Privoxy from source, autoheader, autoconf, GNU make (gmake), and, of
268 course, a C compiler are required.
269
270 When building from a source tarball (either release version or nightly CVS
271 tarball), first unpack the source:
272
273  tar xzvf privoxy-2.9.14-beta-src* [.tgz or .tar.gz]                           
274  cd privoxy-2.9.14-beta                                                        
275                                                                                
276
277 For retrieving the current CVS sources, you'll need CVS installed. Note that
278 sources from CVS are development quality, and may not be stable, or well
279 tested. To download CVS source:
280
281   cvs -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa login          
282   cvs -z3 -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa co current 
283   cd current                                                                         
284                                                                                      
285
286 This will create a directory named current/, which will contain the source
287 tree.
288
289 Then, in either case, to build from unpacked tarball or CVS source:
290
291  autoheader                                                                    
292  autoconf                                                                      
293  ./configure      # (--help to see options)                                    
294  make             # (the make from gnu, gmake for *BSD)                        
295  su                                                                            
296  make -n install  # (to see where all the files will go)                       
297  make install     # (to really install)                                        
298                                                                                
299
300 If you have gnu make, you can have the first four steps automatically done for
301 you by just typing
302
303   make                                                                         
304                                                                                
305
306 in the freshly downloaded or unpacked source directory.
307
308 For more detailed instructions on how to build Redhat and SuSE RPMs, Windows
309 self-extracting installers, building on platforms with special requirements
310 etc, please consult the developer manual.
311
312 -------------------------------------------------------------------------------
313
314 4. Quickstart to Using Privoxy
315
316 4.1. Note to Upgraders
317
318 There are very significant changes from older versions of Junkbuster to the
319 current Privoxy. Configuration is substantially changed. Junkbuster 2.0.x and
320 earlier configuration files will not migrate. The functionality of the old
321 blockfile, cookiefile and imagelist, are now combined into the "actions file"
322 (default.action for most installations).
323
324 A "filter file" (typically default.filter) is new as of Privoxy 2.9.x, and
325 provides some of the new sophistication (explained below). config is much the
326 same as before.
327
328 If upgrading from a 2.0.x version, you will have to use the new config files,
329 and possibly adapt any personal rules from your older files. When porting
330 personal rules over from the old blockfile to the new actions file, please note
331 that even the pattern syntax has changed. If upgrading from 2.9.x development
332 versions, it is still recommended to use the new configuration files.
333
334 A quick list of things to be aware of before upgrading:
335
336   * The default listening port is now 8118 due to a conflict with another
337     service (NAS).
338    
339   * Some installers may remove earlier versions completely. Save any important
340     configuration files!
341    
342   * Privoxy is controllable with a web browser at the special URL: http://
343     config.privoxy.org/ (Shortcut: http://p.p/). Many aspects of configuration
344     can be done here, including temporarily disabling Privoxy.
345    
346   * The primary configuration file for cookie management, ad and banner
347     blocking, and many other aspects of Privoxy configuration is
348     default.action. It is strongly recommended to become familiar with the new
349     actions concept below, before modifying this file.
350    
351   * Some installers may not automatically start Privoxy after installation.
352    
353 -------------------------------------------------------------------------------
354
355 4.2. Starting Privoxy
356
357 Before launching Privoxy for the first time, you will want to configure your
358 browser(s) to use Privoxy as a HTTP and HTTPS proxy. The default is localhost
359 for the proxy address, and port 8118 (earlier versions used port 8000). This is
360 the one configuration step that must be done!
361
362 With Netscape (and Mozilla), this can be set under Edit -> Preferences ->
363 Advanced -> Proxies -> HTTP Proxy. For Internet Explorer: Tools -> Internet
364 Properties -> Connections -> LAN Setting. Then, check "Use Proxy" and fill in
365 the appropriate info (Address: localhost, Port: 8118). Include if HTTPS proxy
366 support too.
367
368 After doing this, flush your browser's disk and memory caches to force a
369 re-reading of all pages and to get rid of any ads that may be cached. You are
370 now ready to start enjoying the benefits of using Privoxy!
371
372 Privoxy is typically started by specifying the main configuration file to be
373 used on the command line. Example Unix startup command:
374
375                                                                                
376  # /usr/sbin/privoxy /etc/privoxy/config                                       
377                                                                                
378                                                                                
379
380 See below for other command line options.
381
382 An init script is provided for SuSE and Red Hat.
383
384 For for SuSE: rcprivoxy start
385
386 For Red Hat and Debian: /etc/rc.d/init.d/privoxy start
387
388 If no configuration file is specified on the command line, Privoxy will look
389 for a file named config in the current directory. Except on Win32 where it will
390 try config.txt. If no file is specified on the command line and no default
391 configuration file can be found, Privoxy will fail to start.
392
393 The included default configuration files should give a reasonable starting
394 point. Most of the per site configuration is done in the "actions" files. These
395 are where various cookie actions are defined, ad and banner blocking, and other
396 aspects of Privoxy configuration. There are several such files included, with
397 varying levels of aggressiveness.
398
399 You will probably want to keep an eye out for sites that require persistent
400 cookies, and add these to default.action as needed. By default, most of these
401 will be accepted only during the current browser session (aka "session
402 cookies"), until you add them to the configuration. If you want the browser to
403 handle this instead, you will need to edit default.action and disable this
404 feature. If you use more than one browser, it would make more sense to let
405 Privoxy handle this. In which case, the browser(s) should be set to accept all
406 cookies.
407
408 Another feature where you will probably want to define exceptions for trusted
409 sites is the popup-killing (through the +popup and +filter{popups} actions),
410 because your favorite shopping, banking, or leisure site may need popups.
411
412 Privoxy is HTTP/1.1 compliant, but not all of the optional 1.1 features are as
413 yet supported. In the unlikely event that you experience inexplicable problems
414 with browsers that use HTTP/1.1 per default (like Mozilla or recent versions of
415 I.E.), you might try to force HTTP/1.0 compatibility. For Mozilla, look under
416 Edit -> Preferences -> Debug -> Networking. Alternatively, set the "+downgrade"
417 config option in default.action which will downgrade your browser's HTTP
418 requests from HTTP/1.1 to HTTP/1.0 before processing them.
419
420 After running Privoxy for a while, you can start to fine tune the configuration
421 to suit your personal, or site, preferences and requirements. There are many,
422 many aspects that can be customized. "Actions" (as specified in default.action)
423 can be adjusted by pointing your browser to http://config.privoxy.org/
424 (shortcut: http://p.p/), and then follow the link to "edit the actions list".
425 (This is an internal page and does not require Internet access.)
426
427 In fact, various aspects of Privoxy configuration can be viewed from this page,
428 including current configuration parameters, source code version numbers, the
429 browser's request headers, and "actions" that apply to a given URL. In addition
430 to the default.action file editor mentioned above, Privoxy can also be turned
431 "on" and "off" (toggled) from this page.
432
433 If you encounter problems, try loading the page without Privoxy. If that helps,
434 enter the URL where you have the problems into the browser based rule tracing
435 utility. See which rules apply and why, and then try turning them off for that
436 site one after the other, until the problem is gone. When you have found the
437 culprit, you might want to turn the rest on again.
438
439 If the above paragraph sounds gibberish to you, you might want to read more
440 about the actions concept or even dive deep into the Appendix on actions.
441
442 If you can't get rid of the problem at all, think you've found a bug in
443 Privoxy, want to propose a new feature or smarter rules, please see the chapter
444 "Contacting the Developers, .." below.
445
446 -------------------------------------------------------------------------------
447
448 4.3. Command Line Options
449
450 Privoxy may be invoked with the following command-line options:
451
452   * --version
453    
454     Print version info and exit. Unix only.
455    
456   * --help
457    
458     Print short usage info and exit. Unix only.
459    
460   * --no-daemon
461    
462     Don't become a daemon, i.e. don't fork and become process group leader, and
463     don't detach from controlling tty. Unix only.
464    
465   * --pidfile FILE
466    
467     On startup, write the process ID to FILE. Delete the FILE on exit. Failure
468     to create or delete the FILE is non-fatal. If no FILE option is given, no
469     PID file will be used. Unix only.
470    
471   * --user USER[.GROUP]
472    
473     After (optionally) writing the PID file, assume the user ID of USER, and if
474     included the GID of GROUP. Exit if the privileges are not sufficient to do
475     so. Unix only.
476    
477   * configfile
478    
479     If no configfile is included on the command line, Privoxy will look for a
480     file named "config" in the current directory (except on Win32 where it will
481     look for "config.txt" instead). Specify full path to avoid confusion. If no
482     config file is found, Privoxy will fail to start.
483    
484 -------------------------------------------------------------------------------
485
486 5. Privoxy Configuration
487
488 All Privoxy configuration is stored in text files. These files can be edited
489 with a text editor. Many important aspects of Privoxy can also be controlled
490 easily with a web browser.
491
492 -------------------------------------------------------------------------------
493
494 5.1. Controlling Privoxy with Your Web Browser
495
496 Privoxy's user interface can be reached through the special URL http://
497 config.privoxy.org/ (shortcut: http://p.p/), which is a built-in page and works
498 without Internet access. You will see the following section: 
499
500  Please choose from the following options:                                     
501                                                                                
502     * Privoxy main page                                                        
503     * Show information about the current configuration                         
504     * Show the source code version numbers                                     
505     * Show the request headers.                                                
506     * Show which actions apply to a URL and why                                
507     * Toggle Privoxy on or off                                                 
508     * Edit the actions list                                                    
509                                                                                
510                                                                                
511
512 This should be self-explanatory. Note the last item is an editor for the
513 "actions list", which is where much of the ad, banner, cookie, and URL blocking
514 magic is configured as well as other advanced features of Privoxy. This is an
515 easy way to adjust various aspects of Privoxy configuration. The actions file,
516 and other configuration files, are explained in detail below.
517
518 "Toggle Privoxy On or Off" is handy for sites that might have problems with
519 your current actions and filters. You can in fact use it as a test to see
520 whether it is Privoxy causing the problem or not. Privoxy continues to run as a
521 proxy in this case, but all filtering is disabled. There is even a toggle 
522 Bookmarklet offered, so that you can toggle Privoxy with one click from your
523 browser.
524
525 -------------------------------------------------------------------------------
526
527 5.2. Configuration Files Overview
528
529 For Unix, *BSD and Linux, all configuration files are located in /etc/privoxy/
530 by default. For MS Windows, OS/2, and AmigaOS these are all in the same
531 directory as the Privoxy executable. The name and number of configuration files
532 has changed from previous versions, and is subject to change as development
533 progresses.
534
535 The installed defaults provide a reasonable starting point, though possibly
536 aggressive by some standards. For the time being, there are only three default
537 configuration files (this may change in time):
538
539   * The main configuration file is named config on Linux, Unix, BSD, OS/2, and
540     AmigaOS and config.txt on Windows.
541    
542   * default.action (the actions file) is used to define which of a set of
543     various "actions" relating to images, banners, pop-ups, access
544     restrictions, banners and cookies are to be applied, and where. There is a
545     web based editor for this file that can be accessed at http://
546     config.privoxy.org/edit-actions/ (Shortcut: http://p.p/edit-actions/).
547     (Other actions files are included as well with differing levels of
548     filtering and blocking, e.g. basic.action.)
549    
550   * default.filter (the filter file) can be used to re-write the raw page
551     content, including viewable text as well as embedded HTML and JavaScript,
552     and whatever else lurks on any given web page. The filtering jobs are only
553     pre-defined here; whether to apply them or not is up to the actions file.
554    
555 All files use the "#" character to denote a comment (the rest of the line will
556 be ignored) and understand line continuation through placing a backslash ("\")
557 as the very last character in a line. If the # is preceded by a backslash, it
558 looses its special function. Placing a # in front of an otherwise valid
559 configuration line to prevent it from being interpreted is called "commenting
560 out" that line.
561
562 default.action and default.filter can use Perl style regular expressions for
563 maximum flexibility.
564
565 After making any changes, there is no need to restart Privoxy in order for the
566 changes to take effect. Privoxy detects such changes automatically. Note,
567 however, that it may take one or two additional requests for the change to take
568 effect. When changing the listening address of Privoxy, these "wake up"
569 requests must obviously be sent to the old listening address.
570
571 While under development, the configuration content is subject to change. The
572 below documentation may not be accurate by the time you read this. Also, what
573 constitutes a "default" setting, may change, so please check all your
574 configuration files on important issues.
575
576 -------------------------------------------------------------------------------
577
578 5.3. The Main Configuration File
579
580 Again, the main configuration file is named config on Linux/Unix/BSD and OS/2,
581 and config.txt on Windows. Configuration lines consist of an initial keyword
582 followed by a list of values, all separated by whitespace (any number of spaces
583 or tabs). For example:
584
585   confdir /etc/privoxy
586    
587
588 Assigns the value /etc/privoxy to the option confdir and thus indicates that
589 the configuration directory is named "/etc/privoxy/".
590
591 All options in the config file except for confdir and logdir are optional.
592 Watch out in the below description for what happens if you leave them unset.
593
594 The main config file controls all aspects of Privoxy's operation that are not
595 location dependent (i.e. they apply universally, no matter where you may be
596 surfing).
597
598 -------------------------------------------------------------------------------
599
600 5.3.1. Configuration and Log File Locations
601
602 Privoxy can (and normally does) use a number of other files for additional
603 configuration and logging. This section of the configuration file tells Privoxy
604 where to find those other files.
605
606 -------------------------------------------------------------------------------
607
608 5.3.1.1. confdir
609
610 Specifies:
611    
612     The directory where the other configuration files are located
613    
614 Type of value:
615    
616     Path name
617    
618 Default value:
619    
620     /etc/privoxy (Unix) or Privoxy installation dir (Windows)
621    
622 Effect if unset:
623    
624     Mandatory
625    
626 Notes:
627    
628     No trailing "/", please
629    
630     When development goes modular and multi-user, the blocker, filter, and
631     per-user config will be stored in subdirectories of "confdir". For now, the
632     configuration directory structure is flat, except for confdir/templates,
633     where the HTML templates for CGI output reside (e.g. Privoxy's 404 error
634     page).
635    
636 -------------------------------------------------------------------------------
637
638 5.3.1.2. logdir
639
640 Specifies:
641    
642     The directory where all logging takes place (i.e. where logfile and jarfile
643     are located)
644    
645 Type of value:
646    
647     Path name
648    
649 Default value:
650    
651     /var/log/privoxy (Unix) or Privoxy installation dir (Windows)
652    
653 Effect if unset:
654    
655     Mandatory
656    
657 Notes:
658    
659     No trailing "/", please
660    
661 -------------------------------------------------------------------------------
662
663 5.3.1.3. actionsfile
664
665 Specifies:
666    
667     The actions file to use
668    
669 Type of value:
670    
671     File name, relative to confdir
672    
673 Default value:
674    
675     default.action (Unix) or default.action.txt (Windows)
676    
677 Effect if unset:
678    
679     No action is taken at all. Simple neutral proxying.
680    
681 Notes:
682    
683     There is no point in using Privoxy without an actions file. There are three
684     different actions files included in the distribution, with varying degrees
685     of aggressiveness: default.action, intermediate.action and advanced.action.
686    
687 -------------------------------------------------------------------------------
688
689 5.3.1.4. filterfile
690
691 Specifies:
692    
693     The filter file to use
694    
695 Type of value:
696    
697     File name, relative to confdir
698    
699 Default value:
700    
701     default.filter (Unix) or default.filter.txt (Windows)
702    
703 Effect if unset:
704    
705     No textual content filtering takes place, i.e. all +filter{name} actions in
706     the actions file are turned off
707    
708 Notes:
709    
710     The "default.filter" file contains content modification rules that use
711     "regular expressions". These rules permit powerful changes on the content
712     of Web pages, e.g., you could disable your favorite JavaScript annoyances,
713     re-write the actual displayed text, or just have some fun replacing
714     "Microsoft" with "MicroSuck" wherever it appears on a Web page.
715    
716 -------------------------------------------------------------------------------
717
718 5.3.1.5. logfile
719
720 Specifies:
721    
722     The log file to use
723    
724 Type of value:
725    
726     File name, relative to logdir
727    
728 Default value:
729    
730     logfile (Unix) or privoxy.log (Windows)
731    
732 Effect if unset:
733    
734     No log file is used, all log messages go to the console (stderr).
735    
736 Notes:
737    
738     The windows version will additionally log to the console.
739    
740     The logfile is where all logging and error messages are written. The level
741     of detail and number of messages are set with the debug option (see below).
742     The logfile can be useful for tracking down a problem with Privoxy (e.g.,
743     it's not blocking an ad you think it should block) but in most cases you
744     probably will never look at it.
745    
746     Your logfile will grow indefinitely, and you will probably want to
747     periodically remove it. On Unix systems, you can do this with a cron job
748     (see "man cron"). For Red Hat, a logrotate script has been included.
749    
750     On SuSE Linux systems, you can place a line like "/var/log/privoxy.* +1024k
751     644 nobody.nogroup" in /etc/logfiles, with the effect that cron.daily will
752     automatically archive, gzip, and empty the log, when it exceeds 1M size.
753    
754 -------------------------------------------------------------------------------
755
756 5.3.1.6. jarfile
757
758 Specifies:
759    
760     The file to store intercepted cookies in
761    
762 Type of value:
763    
764     File name, relative to logdir
765    
766 Default value:
767    
768     jarfile (Unix) or privoxy.jar (Windows)
769    
770 Effect if unset:
771    
772     Intercepted cookies are not stored at all.
773    
774 Notes:
775    
776     The jarfile may grow to ridiculous sizes over time.
777    
778 -------------------------------------------------------------------------------
779
780 5.3.1.7. trustfile
781
782 Specifies:
783    
784     The trust file to use
785    
786 Type of value:
787    
788     File name, relative to confdir
789    
790 Default value:
791    
792     Unset (commented out). When activated: trust (Unix) or trust.txt (Windows)
793    
794 Effect if unset:
795    
796     The whole trust mechanism is turned off.
797    
798 Notes:
799    
800     The trust mechanism is an experimental feature for building white-lists and
801     should be used with care. It is NOT recommended for the casual user.
802    
803     If you specify a trust file, Privoxy will only allow access to sites that
804     are named in the trustfile. You can also mark sites as trusted referrers
805     (with +), with the effect that access to untrusted sites will be granted,
806     if a link from a trusted referrer was used. The link target will then be
807     added to the "trustfile". Possible applications include limiting Internet
808     access for children.
809    
810     If you use + operator in the trust file, it may grow considerably over
811     time.
812    
813 -------------------------------------------------------------------------------
814
815 5.3.2. Local Set-up Documentation
816
817 If you intend to operate Privoxy for more users that just yourself, it might be
818 a good idea to let them know how to reach you, what you block and why you do
819 that, your policies etc.
820
821 -------------------------------------------------------------------------------
822
823 5.3.2.1. trust-info-url
824
825 Specifies:
826    
827     A URL to be displayed in the error page that users will see if access to an
828     untrusted page is denied.
829    
830 Type of value:
831    
832     URL
833    
834 Default value:
835    
836     Two example URL are provided
837    
838 Effect if unset:
839    
840     No links are displayed on the "untrusted" error page.
841    
842 Notes:
843    
844     The value of this option only matters if the experimental trust mechanism
845     has been activated. (See trustfile above.)
846    
847     If you use the trust mechanism, it is a good idea to write up some on-line
848     documentation about your trust policy and to specify the URL(s) here. Use
849     multiple times for multiple URLs.
850    
851     The URL(s) should be added to the trustfile as well, so users don't end up
852     locked out from the information on why they were locked out in the first
853     place!
854    
855 -------------------------------------------------------------------------------
856
857 5.3.2.2. admin-address
858
859 Specifies:
860    
861     An email address to reach the proxy administrator.
862    
863 Type of value:
864    
865     Email address
866    
867 Default value:
868    
869     Unset
870    
871 Effect if unset:
872    
873     No email address is displayed on error pages and the CGI user interface.
874    
875 Notes:
876    
877     If both admin-address and proxy-info-url are unset, the whole "Local
878     Privoxy Support" box on all generated pages will not be shown.
879    
880 -------------------------------------------------------------------------------
881
882 5.3.2.3. proxy-info-url
883
884 Specifies:
885    
886     A URL to documentation about the local Privoxy setup, configuration or
887     policies.
888    
889 Type of value:
890    
891     URL
892    
893 Default value:
894    
895     Unset
896    
897 Effect if unset:
898    
899     No link to local documentation is displayed on error pages and the CGI user
900     interface.
901    
902 Notes:
903    
904     If both admin-address and proxy-info-url are unset, the whole "Local
905     Privoxy Support" box on all generated pages will not be shown.
906    
907     This URL shouldn't be blocked ;-)
908    
909 -------------------------------------------------------------------------------
910
911 5.3.3. Debugging
912
913 These options are mainly useful when tracing a problem. Note that you might
914 also want to invoke Privoxy with the --no-daemon command line option when
915 debugging.
916
917 -------------------------------------------------------------------------------
918
919 5.3.3.1. debug
920
921 Specifies:
922    
923     Key values that determine what information gets logged.
924    
925 Type of value:
926    
927     Integer values
928    
929 Default value:
930    
931     12289 (i.e.: URLs plus informational and warning messages)
932    
933 Effect if unset:
934    
935     Nothing gets logged.
936    
937 Notes:
938    
939     The available debug levels are:
940    
941       debug         1 # show each GET/POST/CONNECT request             
942       debug         2 # show each connection status                    
943       debug         4 # show I/O status                                
944       debug         8 # show header parsing                            
945       debug        16 # log all data into the logfile                  
946       debug        32 # debug force feature                            
947       debug        64 # debug regular expression filter                
948       debug       128 # debug fast redirects                           
949       debug       256 # debug GIF de-animation                         
950       debug       512 # Common Log Format                              
951       debug      1024 # debug kill pop-ups                             
952       debug      4096 # Startup banner and warnings.                   
953       debug      8192 # Non-fatal errors                               
954                                                                        
955    
956     To select multiple debug levels, you can either add them or use multiple
957     debug lines.
958    
959     A debug level of 1 is informative because it will show you each request as
960     it happens. 1, 4096 and 8192 are highly recommended so that you will notice
961     when things go wrong. The other levels are probably only of interest if you
962     are hunting down a specific problem. They can produce a hell of an output
963     (especially 16).
964    
965     The reporting of fatal errors (i.e. ones which crash Privoxy) is always on
966     and cannot be disabled.
967    
968     If you want to use CLF (Common Log Format), you should set "debug 512" ONLY
969     and not enable anything else.
970    
971 -------------------------------------------------------------------------------
972
973 5.3.3.2. single-threaded
974
975 Specifies:
976    
977     Whether to run only one server thread
978    
979 Type of value:
980    
981     None
982    
983 Default value:
984    
985     Unset
986    
987 Effect if unset:
988    
989     Multi-threaded (or, where unavailable: forked) operation, i.e. the ability
990     to serve multiple requests simultaneously.
991    
992 Notes:
993    
994     This option is only there for debug purposes and you should never need to
995     use it. It will drastically reduce performance.
996    
997 -------------------------------------------------------------------------------
998
999 5.3.4. Access Control and Security
1000
1001 This section of the config file controls the security-relevant aspects of
1002 Privoxy's configuration.
1003
1004 -------------------------------------------------------------------------------
1005
1006 5.3.4.1. listen-address
1007
1008 Specifies:
1009    
1010     The IP address and TCP port on which Privoxy will listen for client
1011     requests.
1012    
1013 Type of value:
1014    
1015     [IP-Address]:Port
1016    
1017 Default value:
1018    
1019     localhost:8118
1020    
1021 Effect if unset:
1022    
1023     Bind to localhost (127.0.0.1), port 8118. This is suitable and recommended
1024     for home users who run Privoxy on the same machine as their browser.
1025    
1026 Notes:
1027    
1028     You will need to configure your browser(s) to this proxy address and port.
1029    
1030     If you already have another service running on port 8118, or if you want to
1031     serve requests from other machines (e.g. on your local network) as well,
1032     you will need to override the default.
1033    
1034     If you leave out the IP address, Privoxy will bind to all interfaces
1035     (addresses) on your machine and may become reachable from the Internet. In
1036     that case, consider using access control lists (acl's) (see "ACLs" below),
1037     or a firewall.
1038    
1039 Example:
1040    
1041     Suppose you are running Privoxy on a machine which has the address
1042     192.168.0.1 on your local private network (192.168.0.0) and has another
1043     outside connection with a different address. You want it to serve requests
1044     from inside only:
1045    
1046       listen-address  192.168.0.1:8118                                 
1047                                                                        
1048    
1049 -------------------------------------------------------------------------------
1050
1051 5.3.4.2. toggle
1052
1053 Specifies:
1054    
1055     Initial state of "toggle" status
1056    
1057 Type of value:
1058    
1059     1 or 0
1060    
1061 Default value:
1062    
1063     1
1064    
1065 Effect if unset:
1066    
1067     Act as if toggled on
1068    
1069 Notes:
1070    
1071     If set to 0, Privoxy will start in "toggled off" mode, i.e. behave like a
1072     normal, content-neutral proxy. See enable-remote-toggle below. This is not
1073     really useful anymore, since toggling is much easier via the web interface
1074     then via editing the conf file.
1075    
1076     The windows version will only display the toggle icon in the system tray if
1077     this option is present.
1078    
1079 -------------------------------------------------------------------------------
1080
1081 5.3.4.3. enable-remote-toggle
1082
1083 Specifies:
1084    
1085     Whether or not the web-based toggle feature may be used
1086    
1087 Type of value:
1088    
1089     0 or 1
1090    
1091 Default value:
1092    
1093     1
1094    
1095 Effect if unset:
1096    
1097     The web-based toggle feature is disabled.
1098    
1099 Notes:
1100    
1101     When toggled off, Privoxy acts like a normal, content-neutral proxy, i.e.
1102     it acts as if none of the actions applied to any URL.
1103    
1104     For the time being, access to the toggle feature can not be controlled
1105     separately by "ACLs" or HTTP authentication, so that everybody who can
1106     access Privoxy (see "ACLs" and listen-address above) can toggle it for all
1107     users. So this option is not recommended for multi-user environments with
1108     untrusted users.
1109    
1110     Note that you must have compiled Privoxy with support for this feature,
1111     otherwise this option has no effect.
1112    
1113 -------------------------------------------------------------------------------
1114
1115 5.3.4.4. enable-edit-actions
1116
1117 Specifies:
1118    
1119     Whether or not the web-based actions file editor may be used
1120    
1121 Type of value:
1122    
1123     0 or 1
1124    
1125 Default value:
1126    
1127     1
1128    
1129 Effect if unset:
1130    
1131     The web-based actions file editor is disabled.
1132    
1133 Notes:
1134    
1135     For the time being, access to the editor can not be controlled separately
1136     by "ACLs" or HTTP authentication, so that everybody who can access Privoxy
1137     (see "ACLs" and listen-address above) can modify its configuration for all
1138     users. So this option is not recommended for multi-user environments with
1139     untrusted users.
1140    
1141     Note that you must have compiled Privoxy with support for this feature,
1142     otherwise this option has no effect.
1143    
1144 -------------------------------------------------------------------------------
1145
1146 5.3.4.5. ACLs: permit-access and deny-access
1147
1148 Specifies:
1149    
1150     Who can access what.
1151    
1152 Type of value:
1153    
1154     src_addr[/src_masklen] [dst_addr[/dst_masklen]]
1155    
1156     Where src_addr and dst_addr are IP addresses in dotted decimal notation or
1157     valid DNS names, and src_masklen and dst_masklen are subnet masks in CIDR
1158     notation, i.e. integer values from 2 to 30 representing the length (in
1159     bits) of the network address. The masks and the whole destination part are
1160     optional.
1161    
1162 Default value:
1163    
1164     Unset
1165    
1166 Effect if unset:
1167    
1168     Don't restrict access further than implied by listen-address
1169    
1170 Notes:
1171    
1172     Access controls are included at the request of ISPs and systems
1173     administrators, and are not usually needed by individual users. For a
1174     typical home user, it will normally suffice to ensure that Privoxy only
1175     listens on the localhost or internal (home) network address by means of the
1176     listen-address option.
1177    
1178     Please see the warnings in the FAQ that this proxy is not intended to be a
1179     substitute for a firewall or to encourage anyone to defer addressing basic
1180     security weaknesses.
1181    
1182     Multiple ACL lines are OK. If any ACLs are specified, then the Privoxy
1183     talks only to IP addresses that match at least one permit-access line and
1184     don't match any subsequent deny-access line. In other words, the last match
1185     wins, with the default being deny-access.
1186    
1187     If Privoxy is using a forwarder (see forward below) for a particular
1188     destination URL, the dst_addr that is examined is the address of the
1189     forwarder and NOT the address of the ultimate target. This is necessary
1190     because it may be impossible for the local Privoxy to determine the IP
1191     address of the ultimate target (that's often what gateways are used for).
1192    
1193     You should prefer using IP addresses over DNS names, because the address
1194     lookups take time. All DNS names must resolve! You can not use domain
1195     patterns like "*.org" or partial domain names. If a DNS name resolves to
1196     multiple IP addresses, only the first one is used.
1197    
1198     Denying access to particular sites by ACL may have undesired side effects
1199     if the site in question is hosted on a machine which also hosts other
1200     sites.
1201    
1202 Examples:
1203    
1204     Explicitly define the default behavior if no ACL and listen-address are
1205     set: "localhost" is OK. The absence of a dst_addr implies that all
1206     destination addresses are OK:
1207    
1208       permit-access  localhost                                         
1209                                                                        
1210    
1211     Allow any host on the same class C subnet as www.privoxy.org access to
1212     nothing but www.example.com:
1213    
1214       permit-access  www.privoxy.org/24 www.example.com/32             
1215                                                                        
1216    
1217     Allow access from any host on the 26-bit subnet 192.168.45.64 to anywhere,
1218     with the exception that 192.168.45.73 may not access
1219     www.dirty-stuff.example.com:
1220    
1221       permit-access  192.168.45.64/26                                  
1222       deny-access    192.168.45.73    www.dirty-stuff.example.com      
1223                                                                        
1224    
1225 -------------------------------------------------------------------------------
1226
1227 5.3.4.6. buffer-limit
1228
1229 Specifies:
1230    
1231     Maximum size of the buffer for content filtering.
1232    
1233 Type of value:
1234    
1235     Size in Kbytes
1236    
1237 Default value:
1238    
1239     4096
1240    
1241 Effect if unset:
1242    
1243     Use a 4MB (4096 KB) limit.
1244    
1245 Notes:
1246    
1247     For content filtering, i.e. the +filter and +deanimate-gif actions, it is
1248     necessary that Privoxy buffers the entire document body. This can be
1249     potentially dangerous, since a server could just keep sending data
1250     indefinitely and wait for your RAM to exhaust -- with nasty consequences.
1251     Hence this option.
1252    
1253     When a document buffer size reaches the buffer-limit, it is flushed to the
1254     client unfiltered and no further attempt to filter the rest of the document
1255     is made. Remember that there may be multiple threads running, which might
1256     require up to buffer-limit Kbytes each, unless you have enabled
1257     "single-threaded" above.
1258    
1259 -------------------------------------------------------------------------------
1260
1261 5.3.5. Forwarding
1262
1263 This feature allows routing of HTTP requests through a chain of multiple
1264 proxies. It can be used to better protect privacy and confidentiality when
1265 accessing specific domains by routing requests to those domains through an
1266 anonymous public proxy (see e.g. http://www.multiproxy.org/anon_list.htm) Or to
1267 use a caching proxy to speed up browsing. Or chaining to a parent proxy may be
1268 necessary because the machine that Privoxy runs on has no direct Internet
1269 access.
1270
1271 Also specified here are SOCKS proxies. Privoxy supports the SOCKS 4 and SOCKS
1272 4A protocols.
1273
1274 -------------------------------------------------------------------------------
1275
1276 5.3.5.1. forward
1277
1278 Specifies:
1279    
1280     To which parent HTTP proxy specific requests should be routed.
1281    
1282 Type of value:
1283    
1284     target_domain[:port] http_parent[/port]
1285    
1286     Where target_domain is a domain name pattern (see the chapter on domain
1287     matching in the actions file), http_parent is the address of the parent
1288     HTTP proxy as an IP addresses in dotted decimal notation or as a valid DNS
1289     name (or "." to denote "no forwarding", and the optional port parameters
1290     are TCP ports, i.e. integer values from 1 to 64535
1291    
1292 Default value:
1293    
1294     Unset
1295    
1296 Effect if unset:
1297    
1298     Don't use parent HTTP proxies.
1299    
1300 Notes:
1301    
1302     If http_parent is ".", then requests are not forwarded to another HTTP
1303     proxy but are made directly to the web servers.
1304    
1305     Multiple lines are OK, they are checked in sequence, and the last match
1306     wins.
1307    
1308 Examples:
1309    
1310     Everything goes to an example anonymizing proxy, except SSL on port 443
1311     (which it doesn't handle):
1312    
1313       forward   .*     anon-proxy.example.org:8080                     
1314       forward   :443   .                                               
1315                                                                        
1316    
1317     Everything goes to our example ISP's caching proxy, except for requests to
1318     that ISP's sites:
1319    
1320       forward   .*.                caching-proxy.example-isp.net:8000  
1321       forward   .example-isp.net   .                                   
1322                                                                        
1323    
1324 -------------------------------------------------------------------------------
1325
1326 5.3.5.2. forward-socks4 and forward-socks4a
1327
1328 Specifies:
1329    
1330     Through which SOCKS proxy (and to which parent HTTP proxy) specific
1331     requests should be routed.
1332    
1333 Type of value:
1334    
1335     target_domain[:port] socks_proxy[/port] http_parent[/port]
1336    
1337     Where target_domain is a domain name pattern (see the chapter on domain
1338     matching in the actions file), http_parent and socks_proxy are IP addresses
1339     in dotted decimal notation or valid DNS names (http_parent may be "." to
1340     denote "no HTTP forwarding"), and the optional port parameters are TCP
1341     ports, i.e. integer values from 1 to 64535
1342    
1343 Default value:
1344    
1345     Unset
1346    
1347 Effect if unset:
1348    
1349     Don't use SOCKS proxies.
1350    
1351 Notes:
1352    
1353     Multiple lines are OK, they are checked in sequence, and the last match
1354     wins.
1355    
1356     The difference between forward-socks4 and forward-socks4a is that in the
1357     SOCKS 4A protocol, the DNS resolution of the target hostname happens on the
1358     SOCKS server, while in SOCKS 4 it happens locally.
1359    
1360     If http_parent is ".", then requests are not forwarded to another HTTP
1361     proxy but are made (HTTP-wise) directly to the web servers, albeit through
1362     a SOCKS proxy.
1363    
1364 Examples:
1365    
1366     From the company example.com, direct connections are made to all "internal"
1367     domains, but everything outbound goes through their ISP's proxy by way of
1368     example.com's corporate SOCKS 4A gateway to the Internet.
1369    
1370       forward-socks4a   .*.            socks-gw.example.com:1080  www-cache.example-isp.net:8080 
1371       forward           .example.com   .                                                         
1372                                                                                                  
1373    
1374     A rule that uses a SOCKS 4 gateway for all destinations but no HTTP parent
1375     looks like this:
1376    
1377       forward-socks4   .*.            socks-gw.example.com:1080  .     
1378                                                                        
1379    
1380 -------------------------------------------------------------------------------
1381
1382 5.3.5.3. Advanced Forwarding Examples
1383
1384 If you have links to multiple ISPs that provide various special content only to
1385 their subscribers, you can configure multiple Privoxies which have connections
1386 to the respective ISPs to act as forwarders to each other, so that your users
1387 can see the internal content of all ISPs.
1388
1389 Assume that host-a has a PPP connection to isp-a.net. And host-b has a PPP
1390 connection to isp-b.net. Both run Privoxy. Their forwarding configuration can
1391 look like this:
1392
1393 host-a:
1394
1395   forward    .*.         .                                                     
1396   forward    .isp-b.net  host-b:8118                                           
1397                                                                                
1398
1399 host-b:
1400
1401   forward    .*.         .                                                     
1402   forward    .isp-a.net  host-a:8118                                           
1403                                                                                
1404
1405 Now, your users can set their browser's proxy to use either host-a or host-b
1406 and be able to browse the internal content of both isp-a and isp-b.
1407
1408 If you intend to chain Privoxy and squid locally, then chain as browser ->
1409 squid -> privoxy is the recommended way.
1410
1411 Assuming that Privoxy and squid run on the same box, your squid configuration
1412 could then look like this:
1413
1414   # Define Privoxy as parent proxy (without ICP)                               
1415   cache_peer 127.0.0.1 parent 8118 7 no-query                                  
1416                                                                                
1417   # Define ACL for protocol FTP                                                
1418   acl ftp proto FTP                                                            
1419                                                                                
1420   # Do not forward FTP requests to Privoxy                                     
1421   always_direct allow ftp                                                      
1422                                                                                
1423   # Forward all the rest to Privoxy                                            
1424   never_direct allow all                                                       
1425                                                                                
1426
1427 You would then need to change your browser's proxy settings to squid's address
1428 and port. Squid normally uses port 3128. If unsure consult http_port in
1429 squid.conf.
1430
1431 -------------------------------------------------------------------------------
1432
1433 5.3.6. Windows GUI Options
1434
1435 Privoxy has a number of options specific to the Windows GUI interface:
1436
1437 If "activity-animation" is set to 1, the Privoxy icon will animate when
1438 "Privoxy" is active. To turn off, set to 0.
1439
1440   activity-animation 1
1441    
1442
1443 If "log-messages" is set to 1, Privoxy will log messages to the console window:
1444
1445   log-messages 1
1446    
1447
1448 If "log-buffer-size" is set to 1, the size of the log buffer, i.e. the amount
1449 of memory used for the log messages displayed in the console window, will be
1450 limited to "log-max-lines" (see below).
1451
1452 Warning: Setting this to 0 will result in the buffer to grow infinitely and eat
1453 up all your memory!
1454
1455   log-buffer-size 1
1456    
1457
1458 log-max-lines is the maximum number of lines held in the log buffer. See above.
1459
1460   log-max-lines 200
1461    
1462
1463 If "log-highlight-messages" is set to 1, Privoxy will highlight portions of the
1464 log messages with a bold-faced font:
1465
1466   log-highlight-messages 1
1467    
1468
1469 The font used in the console window:
1470
1471   log-font-name Comic Sans MS
1472    
1473
1474 Font size used in the console window:
1475
1476   log-font-size 8
1477    
1478
1479 "show-on-task-bar" controls whether or not Privoxy will appear as a button on
1480 the Task bar when minimized:
1481
1482   show-on-task-bar 0
1483    
1484
1485 If "close-button-minimizes" is set to 1, the Windows close button will minimize
1486 Privoxy instead of closing the program (close with the exit option on the File
1487 menu).
1488
1489   close-button-minimizes 1
1490    
1491
1492 The "hide-console" option is specific to the MS-Win console version of Privoxy.
1493 If this option is used, Privoxy will disconnect from and hide the command
1494 console.
1495
1496   #hide-console
1497    
1498
1499 -------------------------------------------------------------------------------
1500
1501 5.4. The Actions File
1502
1503 The actions file (default.action, formerly: actionsfile or ijb.action) is used
1504 to define what actions Privoxy takes for which URLs, and thus determines how ad
1505 images, cookies and various other aspects of HTTP content and transactions are
1506 handled on which sites (or even parts thereof).
1507
1508 Anything you want can blocked, including ads, banners, or just some obnoxious
1509 URL that you would rather not see. Cookies can be accepted or rejected, or
1510 accepted only during the current browser session (i.e. not written to disk),
1511 content can be modified, JavaScripts tamed, user-tracking fooled, and much
1512 more. See below for a complete list of available actions.
1513
1514 An actions file typically has sections. At the top, "aliases" are defined
1515 (discussed below), then the default set of rules which will apply universally
1516 to all sites and pages. And then below that is generally a lengthy set of
1517 exceptions to the defined universal policies.
1518
1519 -------------------------------------------------------------------------------
1520
1521 5.4.1. Finding the Right Mix
1522
1523 Note that some actions like cookie suppression or script disabling may render
1524 some sites unusable, which rely on these techniques to work properly. Finding
1525 the right mix of actions is not easy and certainly a matter of personal taste.
1526 In general, it can be said that the more "aggressive" your default settings (in
1527 the top section of the actions file) are, the more exceptions for "trusted"
1528 sites you will have to make later. If, for example, you want to kill popup
1529 windows per default, you'll have to make exceptions from that rule for sites
1530 that you regularly use and that require popups for actually useful content,
1531 like maybe your bank, favorite shop, or newspaper.
1532
1533 We have tried to provide you with reasonable rules to start from in the
1534 distribution actions file. But there is no general rule of thumb on these
1535 things. There just are too many variables, and sites are constantly changing.
1536 Sooner or later you will want to change the rules (and read this chapter).
1537
1538 -------------------------------------------------------------------------------
1539
1540 5.4.2. How to Edit
1541
1542 The easiest way to edit the "actions" file is with a browser by using our
1543 browser-based editor, which is available at http://config.privoxy.org/
1544 edit-actions.
1545
1546 If you prefer plain text editing to GUIs, you can of course also directly edit
1547 the default.action file.
1548
1549 -------------------------------------------------------------------------------
1550
1551 5.4.3. How Actions are Applied to URLs
1552
1553 The actions file is divided into sections. There are special sections, like the
1554 "alias" sections which will be discussed later. For now let's concentrate on
1555 regular sections: They have a heading line (often split up to multiple lines
1556 for readability) which consist of a list of actions, separated by whitespace
1557 and enclosed in curly braces. Below that, there is a list of URL patterns, each
1558 on a separate line.
1559
1560 To determine which actions apply to a request, the URL of the request is
1561 compared to all patterns in this file. Every time it matches, the list of
1562 applicable actions for the URL is incrementally updated, using the heading of
1563 the section in which the pattern is located. If multiple matches for the same
1564 URL set the same action differently, the last match wins.
1565
1566 You can trace this process by visiting http://config.privoxy.org/show-url-info.
1567
1568 More detail on this is provided in the Appendix, Anatomy of an Action.
1569
1570 -------------------------------------------------------------------------------
1571
1572 5.4.4. Patterns
1573
1574 Generally, a pattern has the form <domain>/<path>, where both the <domain> and
1575 <path> are optional. (This is why the pattern / matches all URLs).
1576
1577 www.example.com/
1578    
1579     is a domain-only pattern and will match any request to www.example.com,
1580     regardless of which document on that server is requested.
1581    
1582 www.example.com
1583    
1584     means exactly the same. For domain-only patterns, the trailing / may be
1585     omitted.
1586    
1587 www.example.com/index.html
1588    
1589     matches only the single document /index.html on www.example.com.
1590    
1591 /index.html
1592    
1593     matches the document /index.html, regardless of the domain, i.e. on any web
1594     server.
1595    
1596 index.html
1597    
1598     matches nothing, since it would be interpreted as a domain name and there
1599     is no top-level domain called .html.
1600    
1601 -------------------------------------------------------------------------------
1602
1603 5.4.4.1. The Domain Pattern
1604
1605 The matching of the domain part offers some flexible options: if the domain
1606 starts or ends with a dot, it becomes unanchored at that end. For example:
1607
1608 .example.com
1609    
1610     matches any domain that ENDS in .example.com
1611    
1612 www.
1613    
1614     matches any domain that STARTS with www.
1615    
1616 .example.
1617    
1618     matches any domain that CONTAINS .example. (Correctly speaking: It matches
1619     any FQDN that contains example as a domain.)
1620    
1621 Additionally, there are wild-cards that you can use in the domain names
1622 themselves. They work pretty similar to shell wild-cards: "*" stands for zero
1623 or more arbitrary characters, "?" stands for any single character, you can
1624 define character classes in square brackets and all of that can be freely
1625 mixed:
1626
1627 ad*.example.com
1628    
1629     matches "adserver.example.com", "ads.example.com", etc but not
1630     "sfads.example.com"
1631    
1632 *ad*.example.com
1633    
1634     matches all of the above, and then some.
1635    
1636 .?pix.com
1637    
1638     matches www.ipix.com, pictures.epix.com, a.b.c.d.e.upix.com etc.
1639    
1640 www[1-9a-ez].example.c*
1641    
1642     matches www1.example.com, www4.example.cc, wwwd.example.cy,
1643     wwwz.example.com etc., but not wwww.example.com.
1644    
1645 -------------------------------------------------------------------------------
1646
1647 5.4.4.2. The Path Pattern
1648
1649 Privoxy uses Perl compatible regular expressions (through the PCRE library) for
1650 matching the path.
1651
1652 There is an Appendix with a brief quick-start into regular expressions, and
1653 full (very technical) documentation on PCRE regex syntax is available on-line
1654 at http://www.pcre.org/man.txt. You might also find the Perl man page on
1655 regular expressions (man perlre) useful, which is available on-line at http://
1656 www.perldoc.com/perl5.6/pod/perlre.html.
1657
1658 Note that the path pattern is automatically left-anchored at the "/", i.e. it
1659 matches as if it would start with a "^".
1660
1661 Please also note that matching in the path is case INSENSITIVE by default, but
1662 you can switch to case sensitive at any point in the pattern by using the "(?
1663 -i)" switch: www.example.com/(?-i)PaTtErN.* will match only documents whose
1664 path starts with PaTtErN in exactly this capitalization.
1665
1666 -------------------------------------------------------------------------------
1667
1668 5.4.5. Actions
1669
1670 Actions are enabled if preceded with a "+", and disabled if preceded with a
1671 "-". So a "+action" means "do that action", e.g. "+block" means please "block
1672 the following URLs and/or patterns". All actions are disabled by default, until
1673 they are explicitly enabled somewhere in an actions file.
1674
1675 Actions are invoked by enclosing the action name in curly braces (e.g.
1676 {+some_action}), followed by a list of URLs (or patterns that match URLs) to
1677 which the action applies. There are three classes of actions:
1678
1679   * Boolean, i.e the action can only be "on" or "off". Examples:
1680    
1681       {+name}        # enable this action
1682       {-name}        # disable this action
1683          
1684    
1685   * Parameterized, e.g. "+/-hide-user-agent{ Mozilla 1.0 }", where some value
1686     is required in order to enable this type of action. Examples:
1687    
1688       {+name{param}}  # enable action and set parameter to "param"
1689       {-name}         # disable action ("parameter") can be omitted
1690          
1691    
1692   * Multi-value, e.g. "{+/-add-header{Name: value}}" ot "{+/-wafer{name=value}}
1693     "), where some value needs to be defined in addition to simply enabling the
1694     actino. Examples:
1695    
1696       {+name{param=value}}   # enable action and set "param" to "value"
1697       {-name{param=value}}   # remove the parameter "param" completely
1698       {-name}                # disable this action totally and remove param too
1699          
1700    
1701 If nothing is specified in this file, no "actions" are taken. So in this case
1702 Privoxy would just be a normal, non-blocking, non-anonymizing proxy. You must
1703 specifically enable the privacy and blocking features you need (although the
1704 provided default default.action file will give a good starting point).
1705
1706 Later defined actions always over-ride earlier ones. So exceptions to any rules
1707 you make, should come in the latter part of the file. For multi-valued actions,
1708 the actions are applied in the order they are specified.
1709
1710 The list of valid Privoxy "actions" are:
1711
1712 -------------------------------------------------------------------------------
1713
1714 5.4.5.1. +add-header{Name: value}
1715
1716 Type:
1717    
1718     Multi-value.
1719    
1720 Typical uses:
1721    
1722     Send a user defined HTTP header to the web server.
1723    
1724 Possible values:
1725    
1726     Any value is possible. Validity of the defined HTTP headers is not checked.
1727    
1728 Example usage:
1729    
1730          {+add-header{X-User-Tracking: sucks}}
1731          .example.com
1732         
1733    
1734 Notes:
1735    
1736     This action may be specified multiple times, in order to define multiple
1737     headers. This is rarely needed for the typical user. If you don't know what
1738     "HTTP headers" are, you definitely don't need to worry about this one.
1739    
1740 -------------------------------------------------------------------------------
1741
1742 5.4.5.2. +block
1743
1744 Type:
1745    
1746     Boolean.
1747    
1748 Typical uses:
1749    
1750     Used to block a URL from reaching your browser. The URL may be anything,
1751     but is typically used to block ads or other obnoxious content.
1752    
1753 Possible values:
1754    
1755     N/A
1756    
1757 Example usage:
1758    
1759          {+block}
1760          .example.com
1761          .ads.r.us
1762         
1763    
1764 Notes:
1765    
1766     Privoxy will display its special "BLOCKED" page if a URL matches one of the
1767     blocked patterns. If there is sufficient space, a large red banner will
1768     appear with a friendly message about why the page was blocked, and a way to
1769     go there anyway. If there is insufficient space a smaller blocked page will
1770     appear without the red banner. One exception is if the URL matches both
1771     "+block" and "+image", then it can be handled by "+image-blocker" (see
1772     below).
1773    
1774     The "+filter" action can also perform some of the same functionality as
1775     "+block", but by virtue of very different programming techniques, and is
1776     typically used for different reasons.
1777    
1778 -------------------------------------------------------------------------------
1779
1780 5.4.5.3. +deanimate-gifs
1781
1782 Type:
1783    
1784     Parameterized.
1785    
1786 Typical uses:
1787    
1788     To stop those annoying, distracting animated GIF images.
1789    
1790 Possible values:
1791    
1792     "last" or "first"
1793    
1794 Example usage:
1795    
1796           {+deanimate-gifs{last}}
1797           .example.com
1798         
1799    
1800 Notes:
1801    
1802     De-animate all animated GIF images, i.e. reduce them to their last frame.
1803     This will also shrink the images considerably (in bytes, not pixels!). If
1804     the option "first" is given, the first frame of the animation is used as
1805     the replacement. If "last" is given, the last frame of the animation is
1806     used instead, which probably makes more sense for most banner animations,
1807     but also has the risk of not showing the entire last frame (if it is only a
1808     delta to an earlier frame).
1809    
1810 -------------------------------------------------------------------------------
1811
1812 5.4.5.4. +downgrade
1813
1814 Type:
1815    
1816     Boolean.
1817    
1818 Typical uses:
1819    
1820     "+downgrade" will downgrade HTTP/1.1 client requests to HTTP/1.0 and
1821     downgrade the responses as well.
1822    
1823 Possible values:
1824    
1825     N/A
1826    
1827 Example usage:
1828    
1829          {+downgrade}
1830          .example.com
1831         
1832    
1833 Notes:
1834    
1835     Use this action for servers that use HTTP/1.1 protocol features that
1836     Privoxy doesn't handle well yet. HTTP/1.1 is only partially implemented.
1837     Default is not to downgrade requests. This is an infrequently needed
1838     action, and is used to help with problem sites only.
1839    
1840 -------------------------------------------------------------------------------
1841
1842 5.4.5.5. +fast-redirects
1843
1844 Type:
1845    
1846     Boolean.
1847    
1848 Typical uses:
1849    
1850     The "+fast-redirects" action enables interception of "redirect" requests
1851     from one server to another, which are used to track users.Privoxy can cut
1852     off all but the last valid URL in redirect request and send a local
1853     redirect back to your browser without contacting the intermediate site(s).
1854    
1855 Possible values:
1856    
1857     N/A
1858    
1859 Example usage:
1860    
1861          {+fast-redirects}
1862          .example.com
1863         
1864    
1865 Notes:
1866    
1867     Many sites, like yahoo.com, don't just link to other sites. Instead, they
1868     will link to some script on their own server, giving the destination as a
1869     parameter, which will then redirect you to the final target. URLs resulting
1870     from this scheme typically look like: http://some.place/some_script?http://
1871     some.where-else.
1872    
1873     Sometimes, there are even multiple consecutive redirects encoded in the
1874     URL. These redirections via scripts make your web browsing more traceable,
1875     since the server from which you follow such a link can see where you go to.
1876     Apart from that, valuable bandwidth and time is wasted, while your browser
1877     ask the server for one redirect after the other. Plus, it feeds the
1878     advertisers.
1879    
1880     This is a normally on feature, and often requires exceptions for sites that
1881     are sensitive to defeating this mechanism.
1882    
1883 -------------------------------------------------------------------------------
1884
1885 5.4.5.6. +filter
1886
1887 Type:
1888    
1889     Parameterized.
1890    
1891 Typical uses:
1892    
1893     Apply page filtering as defined by named sections of the default.filter
1894     file to the specified site(s). "Filtering" can be any modification of the
1895     raw page content, including re-writing or deletion of content.
1896    
1897 Possible values:
1898    
1899     "+filter" must include the name of one of the section identifiers from
1900     default.filter (or whatever filterfile is specified in config).
1901    
1902 Example usage (from the current default.filter):
1903    
1904     +filter{html-annoyances}: Get rid of particularly annoying HTML abuse.
1905    
1906     +filter{js-annoyances}: Get rid of particularly annoying JavaScript abuse
1907    
1908     +filter{content-cookies}: Kill cookies that come in the HTML or JS content
1909    
1910     +filter{popups}: Kill all popups in JS and HTML
1911    
1912     +filter{frameset-borders}: Give frames a border and make them resizable
1913    
1914     +filter{webbugs}: Squish WebBugs (1x1 invisible GIFs used for user         
1915     tracking)                                                                  
1916    
1917     +filter{refresh-tags}: Kill automatic refresh tags (for dial-on-demand     
1918     setups)                                                                    
1919    
1920     +filter{fun}: Text replacements for subversive browsing fun!
1921    
1922     +filter{nimda}: Remove Nimda (virus) code.
1923    
1924     +filter{banners-by-size}: Kill banners by size (very efficient!)
1925    
1926     +filter{shockwave-flash}: Kill embedded Shockwave Flash objects
1927    
1928     +filter{crude-parental}: Kill all web pages that contain the words "sex" or
1929     "warez"                                                                    
1930    
1931 Notes:
1932    
1933     This is potentially a very powerful feature! And requires a knowledge of
1934     regular expressions if you want to "roll your own". Filtering operates on a
1935     line by line basis.
1936    
1937     Filtering requires buffering the page content, which may appear to slow
1938     down page rendering since nothing is displayed until all content has passed
1939     the filters. (It does not really take longer, but seems that way since the
1940     page is not incrementally displayed.) This effect will be more noticeable
1941     on slower connections.
1942    
1943     Filtering can achieve some of the effects as the "+block" action, i.e. it
1944     can be used to block ads and banners. In the overall scheme of things,
1945     filtering is one of the last things "Privoxy" does with a web page. So
1946     other actions are applied first.
1947    
1948 -------------------------------------------------------------------------------
1949
1950 5.4.5.7. +hide-forwarded
1951
1952 Type:
1953    
1954     Boolean.
1955    
1956 Typical uses:
1957    
1958     Block any existing X-Forwarded-for HTTP header, and do not add a new one.
1959    
1960 Possible values:
1961    
1962     N/A
1963    
1964 Example usage:
1965    
1966          {+hide-forwarded}
1967          .example.com
1968         
1969    
1970 Notes:
1971    
1972     It is fairly safe to leave this on. It does not seem to break many sites.
1973    
1974 -------------------------------------------------------------------------------
1975
1976 5.4.5.8. +hide-from
1977
1978 Type:
1979    
1980     Parameterized.
1981    
1982 Typical uses:
1983    
1984     To block the browser from sending your email address in a "From:" header.
1985    
1986 Possible values:
1987    
1988     Keyword: "block", or any user defined value.
1989    
1990 Example usage:
1991    
1992          {+hide-from{block}}
1993          .example.com
1994         
1995    
1996 Notes:
1997    
1998     The keyword "block" will completely remove the header. Alternately, you can
1999     specify any value you prefer to send to the web server.
2000    
2001 -------------------------------------------------------------------------------
2002
2003 5.4.5.9. +hide-referer
2004
2005 Type:
2006    
2007     Parameterized.
2008    
2009 Typical uses:
2010    
2011     Don't send the "Referer:" (sic) HTTP header to the web site. Or,
2012     alternately send a forged header instead.
2013    
2014 Possible values:
2015    
2016     Prevent the header from being sent with the keyword, "block". Or, "forge" a
2017     URL to one from the same server as the request. Or, set to user defined
2018     value of your choice.
2019    
2020 Example usage:
2021    
2022          {+hide-referer{forge}}
2023          .example.com
2024         
2025    
2026 Notes:
2027    
2028     "forge" is the preferred option here, since some servers will not send
2029     images back otherwise.
2030    
2031     "+hide-referrer" is an alternate spelling of "+hide-referer". It has the
2032     exact same parameters, and can be freely mixed with, "+hide-referer".
2033     ("referrer" is the correct English spelling, however the HTTP specification
2034     has a bug - it requires it to be spelled as "referer".)
2035    
2036 -------------------------------------------------------------------------------
2037
2038 5.4.5.10. +hide-user-agent
2039
2040 Type:
2041    
2042     Parameterized.
2043    
2044 Typical uses:
2045    
2046     To change the "User-Agent:" header so web servers can't tell your browser
2047     type. Who's business is it anyway?
2048    
2049 Possible values:
2050    
2051     Any user defined string.
2052    
2053 Example usage:
2054    
2055          {+hide-user-agent{Netscape 6.1 (X11; I; Linux 2.4.18 i686)}}
2056          .msn.com
2057         
2058    
2059 Notes:
2060    
2061     Warning! This breaks many web sites that depend on this in order to
2062     determine how the target browser will respond to various requests. Use with
2063     caution.
2064    
2065 -------------------------------------------------------------------------------
2066
2067 5.4.5.11. +image
2068
2069 Type:
2070    
2071     Boolean.
2072    
2073 Typical uses:
2074    
2075     To define what Privoxy should treat automatically as an image.
2076    
2077 Possible values:
2078    
2079     N/A
2080    
2081 Example usage:
2082    
2083          {+image}
2084          /.*\.(gif|jpg|jpeg|png|bmp|ico)
2085         
2086    
2087 Notes:
2088    
2089     This only has meaning if the URL (or pattern) also is "+block"ed, in which
2090     case a "blocked" image can be sent rather than a HTML page. (See
2091     "+image-blocker{}" below for the control over what is actually sent.)
2092    
2093     There is little reason to change the default definition for this.
2094    
2095 -------------------------------------------------------------------------------
2096
2097 5.4.5.12. +image-blocker
2098
2099 Type:
2100    
2101     Parameterized.
2102    
2103 Typical uses:
2104    
2105     Decide what to do with URLs that end up tagged with both "{+block}" and "
2106     {+image}", e.g an advertisement.
2107    
2108 Possible values:
2109    
2110     There are four available options: "-image-blocker" will send a HTML
2111     "blocked" page, usually resulting in a "broken image" icon. "+image-blocker
2112     {blank}" will send a 1x1 transparent GIF image. "+image-blocker{pattern}"
2113     will send a checkerboard type pattern (the default). And finally,
2114     "+image-blocker{http://xyz.com}" will send a HTTP temporary redirect to the
2115     specified image. This has the advantage of the icon being being cached by
2116     the browser, which will speed up the display.
2117    
2118 Example usage:
2119    
2120          {+image-blocker{blank}}
2121          .example.com
2122         
2123    
2124 Notes:
2125    
2126     If you want invisible ads, they need to be both defined as images and
2127     blocked. And then, "image-blocker" should be set to "blank" for
2128     invisibility. Note you cannot treat HTML pages as images in most cases. For
2129     instance, frames require an HTML page to display. So a frame that is an ad,
2130     cannot be treated as an image. Forcing an "image" in this situation just
2131     will not work.
2132    
2133 -------------------------------------------------------------------------------
2134
2135 5.4.5.13. +limit-connect
2136
2137 Type:
2138    
2139     Parameterized.
2140    
2141 Typical uses:
2142    
2143     By default, Privoxy only allows HTTP CONNECT requests to port 443 (the
2144     standard, secure HTTPS port). Use "+limit-connect" to disable this
2145     altogether, or to allow more ports.
2146    
2147 Possible values:
2148    
2149     Any valid port number, or port number range.
2150    
2151 Example usages:
2152    
2153          +limit-connect{443}                      #
2154      This is the default and need not be specified.
2155          +limit-connect{80,443}                 # Ports 80 and 443 are OK.
2156          +limit-connect{-3, 7, 20-100, 500-} #
2157      Port less than 3, 7, 20 to 100 and above 500 are OK.
2158         
2159    
2160 Notes:
2161    
2162     The CONNECT methods exists in HTTP to allow access to secure websites
2163     (https:// URLs) through proxies. It works very simply: the proxy connects
2164     to the server on the specified port, and then short-circuits its
2165     connections to the client and to the remote proxy. This can be a big
2166     security hole, since CONNECT-enabled proxies can be abused as TCP relays
2167     very easily.
2168    
2169     If you want to allow CONNECT for more ports than this, or want to forbid
2170     CONNECT altogether, you can specify a comma separated list of ports and
2171     port ranges (the latter using dashes, with the minimum defaulting to 0 and
2172     max to 65K).
2173    
2174     If you don't know what any of this means, there probably is no reason to
2175     change this one.
2176    
2177 -------------------------------------------------------------------------------
2178
2179 5.4.5.14. +no-compression
2180
2181 Type:
2182    
2183     Boolean.
2184    
2185 Typical uses:
2186    
2187     Prevent the specified websites from compressing HTTP data.
2188    
2189 Possible values:
2190    
2191     N/A
2192    
2193 Example usage:
2194    
2195          {+no-compression}
2196          .example.com
2197         
2198    
2199 Notes:
2200    
2201     Some websites do this, which can be a problem for Privoxy, since "+filter",
2202     "+no-popup" and "+gif-deanimate" will not work on compressed data. This
2203     will slow down connections to those websites, though. Default typically is
2204     to turn "no-compression" on.
2205    
2206 -------------------------------------------------------------------------------
2207
2208 5.4.5.15. +no-cookies-keep
2209
2210 Type:
2211    
2212     Boolean.
2213    
2214 Typical uses:
2215    
2216     Allow cookies for the current browser session only.
2217    
2218 Possible values:
2219    
2220     N/A
2221    
2222 Example usage:
2223    
2224          {+no-cookies-keep}
2225          .example.com
2226         
2227    
2228 Notes:
2229    
2230     If websites set cookies, "no-cookies-keep" will make sure they are erased
2231     when you exit and restart your web browser. This makes profiling cookies
2232     useless, but won't break sites which require cookies so that you can log in
2233     for transactions. This is generally turned on for all sites. Sometimes
2234     referred to as "session cookies".
2235    
2236 -------------------------------------------------------------------------------
2237
2238 5.4.5.16. +no-cookies-read
2239
2240 Type:
2241    
2242     Boolean.
2243    
2244 Typical uses:
2245    
2246     Explicitly prevent the web server from reading any cookies on your system.
2247    
2248 Possible values:
2249    
2250     N/A
2251    
2252 Example usage:
2253    
2254          {+no-cookies-read}
2255          .example.com
2256         
2257    
2258 Notes:
2259    
2260     Often used in conjunction with "+no-cookies-set" to disable persistant
2261     cookies completely.
2262    
2263 -------------------------------------------------------------------------------
2264
2265 5.4.5.17. +no-cookies-set
2266
2267 Type:
2268    
2269     Boolean.
2270    
2271 Typical uses:
2272    
2273     Explicitly block the web server from sending cookies to your system.
2274    
2275 Possible values:
2276    
2277     N/A
2278    
2279 Example usage:
2280    
2281          {+no-cookies-set}
2282          .example.com
2283         
2284    
2285 Notes:
2286    
2287     Often used in conjunction with "+no-cookies-read" to disable persistant
2288     cookies completely.
2289    
2290 -------------------------------------------------------------------------------
2291
2292 5.4.5.18. +no-popup
2293
2294 Type:
2295    
2296     Boolean.
2297    
2298 Typical uses:
2299    
2300     Stop those annoying JavaScript pop-up windows!
2301    
2302 Possible values:
2303    
2304     N/A
2305    
2306 Example usage:
2307    
2308          {+no-popup}
2309          .example.com
2310         
2311    
2312 Notes:
2313    
2314     "+no-popup" uses a built in filter to disable pop-ups that use the
2315     window.open() function, etc.
2316    
2317     An alternate spelling is "+no-popups", which is interchangeable.
2318    
2319 -------------------------------------------------------------------------------
2320
2321 5.4.5.19. +vanilla-wafer
2322
2323 Type:
2324    
2325     Boolean.
2326    
2327 Typical uses:
2328    
2329     Sends a cookie for every site stating that you do not accept any copyright
2330     on cookies sent to you, and asking them not to track you.
2331    
2332 Possible values:
2333    
2334     N/A
2335    
2336 Example usage:
2337    
2338          {+vanilla-wafer}
2339          .example.com
2340         
2341    
2342 Notes:
2343    
2344     This action only applies if you are using a jarfile for saving cookies. Of
2345     course, this is a (relatively) unique header and could be used to track
2346     you.
2347    
2348 -------------------------------------------------------------------------------
2349
2350 5.4.5.20. +wafer
2351
2352 Type:
2353    
2354     Multi-value.
2355    
2356 Typical uses:
2357    
2358     This allows you to send an arbitrary, user definable cookie.
2359    
2360 Possible values:
2361    
2362     User specified cookie name and corresponding value.
2363    
2364 Example usage:
2365    
2366          {+wafer{name=value}}
2367          .example.com
2368         
2369    
2370 Notes:
2371    
2372     This can be specified multiple times in order to add as many cookies as you
2373     like.
2374    
2375 -------------------------------------------------------------------------------
2376
2377 5.4.5.21. Actions Examples
2378
2379 Note that the meaning of any of the above examples is reversed by preceding the
2380 action with a "-", in place of the "+". Also, that some actions are turned on
2381 in the default section of the actions file, and require little to no additional
2382 configuration. These are just "on". Some actions that are turned on the default
2383 section do typically require exceptions to be listed in the lower sections of
2384 actions file.
2385
2386 Some examples:
2387
2388 Turn off cookies by default, then allow a few through for specified sites:
2389
2390  # Turn off all persistent cookies
2391  { +no-cookies-read }
2392  { +no-cookies-set }
2393  
2394  # Allow cookies for this browser session ONLY
2395  { +no-cookies-keep }
2396
2397  # Exceptions to the above, sites that benefit from persistent cookies
2398  # that saved from one browser session to the next.
2399  { -no-cookies-read }
2400  { -no-cookies-set }
2401  { -no-cookies-keep }
2402  .javasoft.com
2403  .sun.com
2404  .yahoo.com
2405  .msdn.microsoft.com
2406  .redhat.com
2407
2408  # Alternative way of saying the same thing
2409  {-no-cookies-set -no-cookies-read -no-cookies-keep}
2410  .sourceforge.net
2411  .sf.net
2412    
2413
2414 Now turn off "fast redirects", and then we allow two exceptions:
2415
2416  # Turn them off!
2417  {+fast-redirects}
2418  
2419  # Reverse it for these two sites, which don't work right without it.
2420  {-fast-redirects}
2421  www.ukc.ac.uk/cgi-bin/wac\.cgi\?
2422  login.yahoo.com
2423    
2424
2425 Turn on page filtering according to rules in the defined sections of
2426 default.filter, and make one exception for Sourceforge:
2427
2428  # Run everything through the filter file, using only the
2429  # specified sections:
2430  +filter{html-annoyances} +filter{js-annoyances} +filter{no-popups}\
2431  +filter{webbugs} +filter{nimda} +filter{banners-by-size}
2432               
2433  # Then disable filtering of code from sourceforge!
2434  {-filter}
2435  .cvs.sourceforge.net
2436    
2437
2438 Now some URLs that we want "blocked" (normally generates the "blocked" banner).
2439 Many of these use regular expressions that will expand to match multiple URLs:
2440
2441   # Blocklist:
2442   {+block}
2443   /.*/(.*[-_.])?ads?[0-9]?(/|[-_.].*|\.(gif|jpe?g))
2444   /.*/(.*[-_.])?count(er)?(\.cgi|\.dll|\.exe|[?/])
2445   /.*/(ng)?adclient\.cgi
2446   /.*/(plain|live|rotate)[-_.]?ads?/
2447   /.*/(sponsor)s?[0-9]?/
2448   /.*/_?(plain|live)?ads?(-banners)?/
2449   /.*/abanners/
2450   /.*/ad(sdna_image|gifs?)/
2451   /.*/ad(server|stream|juggler)\.(cgi|pl|dll|exe)
2452   /.*/adbanners/
2453   /.*/adserver
2454   /.*/adstream\.cgi
2455   /.*/adv((er)?ts?|ertis(ing|ements?))?/
2456   /.*/banner_?ads/
2457   /.*/banners?/
2458   /.*/banners?\.cgi/
2459   /.*/cgi-bin/centralad/getimage
2460   /.*/images/addver\.gif
2461   /.*/images/marketing/.*\.(gif|jpe?g)
2462   /.*/popupads/
2463   /.*/siteads/
2464   /.*/sponsor.*\.gif
2465   /.*/sponsors?[0-9]?/
2466   /.*/advert[0-9]+\.jpg
2467   /Media/Images/Adds/
2468   /ad_images/
2469   /adimages/
2470   /.*/ads/
2471   /bannerfarm/
2472   /grafikk/annonse/
2473   /graphics/defaultAd/
2474   /image\.ng/AdType
2475   /image\.ng/transactionID
2476   /images/.*/.*_anim\.gif # alvin brattli
2477   /ip_img/.*\.(gif|jpe?g)
2478   /rotateads/
2479   /rotations/ 
2480   /worldnet/ad\.cgi
2481   /cgi-bin/nph-adclick.exe/
2482   /.*/Image/BannerAdvertising/
2483   /.*/ad-bin/
2484   /.*/adlib/server\.cgi
2485   /autoads/
2486    
2487
2488 Note that many of these actions have the potential to cause a page to
2489 misbehave, possibly even not to display at all. There are many ways a site
2490 designer may choose to design his site, and what HTTP header content he may
2491 depend on. There is no way to have hard and fast rules for all sites. See the 
2492 Appendix for a brief example on troubleshooting actions.
2493
2494 -------------------------------------------------------------------------------
2495
2496 5.4.6. Aliases
2497
2498 Custom "actions", known to Privoxy as "aliases", can be defined by combining
2499 other "actions". These can in turn be invoked just like the built-in "actions".
2500 Currently, an alias can contain any character except space, tab, "=", "{" or "}
2501 ". But please use only "a"- "z", "0"-"9", "+", and "-". Alias names are not
2502 case sensitive, and must be defined before anything else in the
2503 default.actionfile! And there can only be one set of "aliases" defined.
2504
2505 Now let's define a few aliases:
2506
2507  # Useful custom aliases we can use later. These must come first!
2508  {{alias}}
2509  +no-cookies = +no-cookies-set +no-cookies-read
2510  -no-cookies = -no-cookies-set -no-cookies-read
2511  fragile     =
2512  -block -no-cookies -filter -fast-redirects -hide-referer -no-popups
2513  shop        = -no-cookies -filter -fast-redirects
2514  +imageblock = +block +image
2515
2516  #For people who don't like to type too much:  ;-)
2517  c0 = +no-cookies
2518  c1 = -no-cookies
2519  c2 = -no-cookies-set +no-cookies-read
2520  c3 = +no-cookies-set -no-cookies-read
2521  #... etc.  Customize to your heart's content.
2522    
2523
2524 Some examples using our "shop" and "fragile" aliases from above:
2525
2526  # These sites are very complex and require
2527  # minimal interference.
2528  {fragile}
2529  .office.microsoft.com
2530  .windowsupdate.microsoft.com
2531  .nytimes.com
2532
2533  # Shopping sites - but we still want to block ads.
2534  {shop}
2535  .quietpc.com
2536  .worldpay.com   # for quietpc.com
2537  .jungle.com
2538  .scan.co.uk
2539
2540  # These shops require pop-ups also 
2541  {shop -no-popups}
2542  .dabs.com
2543  .overclockers.co.uk
2544    
2545
2546 The "shop" and "fragile" aliases are often used for "problem" sites that
2547 require most actions to be disabled in order to function properly. 
2548
2549 -------------------------------------------------------------------------------
2550
2551 5.5. The Filter File
2552
2553 Any web page can be dynamically modified with the filter file. This
2554 modification can be removal, or re-writing, of any web page content, including
2555 tags and non-visible content. The default filter file is default.filter,
2556 located in the config directory.
2557
2558 This is potentially a very powerful feature, and requires knowledge of both
2559 "regular expression" and HTML in order create custom filters. But, there are a
2560 number of useful filters included with Privoxy for many common situations.
2561
2562 The included example file is divided into sections. Each section begins with
2563 the FILTER keyword, followed by the identifier for that section, e.g. "FILTER:
2564 webbugs". Each section performs a similar type of filtering, such as
2565 "html-annoyances".
2566
2567 This file uses regular expressions to alter or remove any string in the target
2568 page. The expressions can only operate on one line at a time. Some examples
2569 from the included default default.filter:
2570
2571 Stop web pages from displaying annoying messages in the status bar by deleting
2572 such references:
2573
2574  FILTER: html-annoyances
2575
2576  # New browser windows should be resizeable and have a location and status
2577  # bar. Make it so.
2578  #
2579  s/resizable="?(no|0)"?/resizable=1/ig s/noresize/yesresize/ig
2580  s/location="?(no|0)"?/location=1/ig s/status="?(no|0)"?/status=1/ig
2581  s/scrolling="?(no|0|Auto)"?/scrolling=1/ig
2582  s/menubar="?(no|0)"?/menubar=1/ig 
2583
2584  # The <BLINK> tag was a crime!
2585  #
2586  s*<blink>|</blink>**ig
2587
2588  # Is this evil? 
2589  #
2590  #s/framespacing="?(no|0)"?//ig
2591  #s/margin(height|width)=[0-9]*//gi
2592    
2593
2594 Just for kicks, replace any occurrence of "Microsoft" with "MicroSuck", and
2595 have a little fun with topical buzzwords:
2596
2597  FILTER: fun
2598
2599  s/microsoft(?!.com)/MicroSuck/ig
2600
2601  # Buzzword Bingo:
2602  #
2603  s/industry-leading|cutting-edge|award-winning/<font color=red><b>BINGO!</b></
2604 font>/ig
2605    
2606
2607 Kill those pesky little web-bugs:
2608
2609  # webbugs: Squish WebBugs (1x1 invisible GIFs used for user tracking)
2610  FILTER: webbugs
2611
2612  s/<img\s+[^>]*?(width|height)\s*=\s*['"]?1\D[^>]*?(width|height)\s*=\s*['"]?1
2613 (\D[^>]*?)?>/<!-- Squished WebBug -->/sig
2614    
2615
2616 -------------------------------------------------------------------------------
2617
2618 5.6. Templates
2619
2620 When Privoxy displays one of its internal pages, such as a 404 Not Found error
2621 page, it uses the appropriate template. On Linux, BSD, and Unix, these are
2622 located in /etc/privoxy/templates by default. These may be customized, if
2623 desired. cgi-style.css is used to control the HTML attributes (fonts, etc).
2624
2625 The default "Blocked" banner page with the bright red top banner, is called
2626 just "blocked". This may be customized or replaced with something else if
2627 desired. 
2628
2629 -------------------------------------------------------------------------------
2630
2631 6. Contacting the Developers, Bug Reporting and Feature Requests
2632
2633 We value your feedback. However, to provide you with the best support, please
2634 note:
2635
2636   * Use the Sourceforge Support Forum to get help:
2637        
2638         http://sourceforge.net/tracker/?group_id=11118&atid=211118
2639        
2640    
2641   * Submit bugs only through our Sourceforge Bug Forum:
2642      
2643         http://sourceforge.net/tracker/?group_id=11118&atid=111118. 
2644         
2645    
2646     Make sure that the bug has not already been submitted. Please try to verify
2647     that it is a Privoxy bug, and not a browser or site bug first. If you are
2648     using your own custom configuration, please try the stock configs to see if
2649     the problem is a configuration related bug. And if not using the latest
2650     development snapshot, please try the latest one. Or even better, CVS
2651     sources. Please be sure to include the Privoxy/Junkbuster version,
2652     platform, browser, any pertinent log data, any other relevant details
2653     (please be specific) and, if possible, some way to reproduce the bug.
2654    
2655   * Submit feature requests only through our Sourceforge feature request forum:
2656      
2657         http://sourceforge.net/tracker/?atid=361118&group_id=11118&func=browse.
2658        
2659    
2660   * You can also send feedback on websites that Privoxy has problems with. Please bookmark
2661     the following link: "Privoxy - Submit Filter Feedback"
2662     . Once you surf to a page with problems, use the
2663     bookmark to send us feedback. We will look into the issue as soon as possible.
2664        
2665    
2666   * For any other issues, feel free to use the mailing lists:
2667      
2668         http://sourceforge.net/mail/?group_id=11118.
2669      
2670    
2671     Anyone interested in actively participating in development and related
2672     discussions can also join the appropriate mailing list. Archives are
2673     available, too.
2674    
2675 -------------------------------------------------------------------------------
2676
2677 6.1. Submitting Ads and "Action" Problems
2678
2679 Ads and banners that are not stopped by Privoxy can be submitted to the
2680 developers by accessing a special page and filling out the brief, required
2681 form. Conversely, you can also report pages, images, etc. that Privoxy is
2682 blocking, but should not. The form itself does require Internet access.
2683
2684 To do this, point your browser to Privoxy at http://config.privoxy.org/
2685 (shortcut: http://p.p/), and then select Actions file feedback system, near the
2686 bottom of the page. Paste in the URL that is the cause of the unwanted
2687 behavior, and follow the prompts. The developers will try to incorporate a fix
2688 for the problem you reported into future versions.
2689
2690 New default.actions files will occasionally be made available based on your
2691 feedback. These will be announced on the ijbswa-announce list.
2692
2693 -------------------------------------------------------------------------------
2694
2695 7. Copyright and History
2696
2697 7.1. Copyright
2698
2699 Privoxy is free software; you can redistribute it and/or modify it under the
2700 terms of the GNU General Public License as published by the Free Software
2701 Foundation; either version 2 of the License, or (at your option) any later
2702 version.
2703
2704 This program is distributed in the hope that it will be useful, but WITHOUT ANY
2705 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
2706 PARTICULAR PURPOSE. See the GNU General Public License for more details, which
2707 is available from the Free Software Foundation, Inc, 59 Temple Place - Suite
2708 330, Boston, MA 02111-1307, USA.
2709
2710 You should have received a copy of the GNU General Public License along with
2711 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
2712 Place, Suite 330, Boston, MA 02111-1307 USA.
2713
2714 -------------------------------------------------------------------------------
2715
2716 7.2. History
2717
2718 Privoxy is evolved, and derived from, the Internet Junkbuster, with many
2719 improvments and enhancements over the original.
2720
2721 Junkbuster was originally written by Anonymous Coders and Junkbusters
2722 Corporation, and was released as free open-source software under the GNU GPL. 
2723 Stefan Waldherr made many improvements, and started the SourceForge project
2724 Privoxy to rekindle development. There are now several active developers
2725 contributing. The last stable release of Junkbuster was v2.0.2, which has now
2726 grown whiskers ;-).
2727
2728 -------------------------------------------------------------------------------
2729
2730 8. See Also
2731
2732 Other references and sites of interest to Privoxy users:
2733
2734 http://www.privoxy.org/, The Privoxy Home page.
2735
2736 http://sourceforge.net/projects/ijbswa, the Project Page for Privoxy on        
2737 Sourceforge.                                                                   
2738
2739 http://p.p/, access Privoxy from your browser. Alternately, http://            
2740 config.privoxy.org may work in some situations where the first does not.       
2741
2742 http://p.p/, and select "actions file feedback system" to submit "misses" to   
2743 the developers.                                                                
2744
2745 http://www.junkbusters.com/ht/en/cookies.html
2746
2747 http://www.waldherr.org/junkbuster/
2748
2749 http://privacy.net/analyze/
2750
2751 http://www.squid-cache.org/
2752
2753  
2754
2755 -------------------------------------------------------------------------------
2756
2757 9. Appendix
2758
2759 9.1. Regular Expressions
2760
2761 Privoxy can use "regular expressions" in various config files. Assuming support
2762 for "pcre" (Perl Compatible Regular Expressions) is compiled in, which is the
2763 default. Such configuration directives do not require regular expressions, but
2764 they can be used to increase flexibility by matching a pattern with wild-cards
2765 against URLs.
2766
2767 If you are reading this, you probably don't understand what "regular
2768 expressions" are, or what they can do. So this will be a very brief
2769 introduction only. A full explanation would require a book ;-)
2770
2771 "Regular expressions" is a way of matching one character expression against
2772 another to see if it matches or not. One of the "expressions" is a literal
2773 string of readable characters (letter, numbers, etc), and the other is a
2774 complex string of literal characters combined with wild-cards, and other
2775 special characters, called meta-characters. The "meta-characters" have special
2776 meanings and are used to build the complex pattern to be matched against. Perl
2777 Compatible Regular Expressions is an enhanced form of the regular expression
2778 language with backward compatibility.
2779
2780 To make a simple analogy, we do something similar when we use wild-card
2781 characters when listing files with the dir command in DOS. *.* matches all
2782 filenames. The "special" character here is the asterisk which matches any and
2783 all characters. We can be more specific and use ? to match just individual
2784 characters. So "dir file?.text" would match "file1.txt", "file2.txt", etc. We
2785 are pattern matching, using a similar technique to "regular expressions"!
2786
2787 Regular expressions do essentially the same thing, but are much, much more
2788 powerful. There are many more "special characters" and ways of building complex
2789 patterns however. Let's look at a few of the common ones, and then some
2790 examples:
2791
2792 . - Matches any single character, e.g. "a", "A", "4", ":", or "@".
2793
2794 ? - The preceding character or expression is matched ZERO or ONE times. Either/
2795 or.                                                                            
2796
2797 + - The preceding character or expression is matched ONE or MORE times.
2798
2799 * - The preceding character or expression is matched ZERO or MORE times.
2800
2801 \ - The "escape" character denotes that the following character should be taken
2802 literally. This is used where one of the special characters (e.g. ".") needs to
2803 be taken literally and not as a special meta-character. Example: "example      
2804 \.com", makes sure the period is recognized only as a period (and not expanded 
2805 to its metacharacter meaning of any single character).                         
2806
2807 [] - Characters enclosed in brackets will be matched if any of the enclosed    
2808 characters are encountered. For instance, "[0-9]" matches any numeric digit    
2809 (zero through nine). As an example, we can combine this with "+" to match any  
2810 digit one of more times: "[0-9]+".                                             
2811
2812 () - parentheses are used to group a sub-expression, or multiple               
2813 sub-expressions.                                                               
2814
2815 | - The "bar" character works like an "or" conditional statement. A match is   
2816 successful if the sub-expression on either side of "|" matches. As an example: 
2817 "/(this|that) example/" uses grouping and the bar character and would match    
2818 either "this example" or "that example", and nothing else.                     
2819
2820 s/string1/string2/g - This is used to rewrite strings of text. "string1" is    
2821 replaced by "string2" in this example. There must of course be a match on      
2822 "string1" first.                                                               
2823
2824 These are just some of the ones you are likely to use when matching URLs with
2825 Privoxy, and is a long way from a definitive list. This is enough to get us
2826 started with a few simple examples which may be more illuminating:
2827
2828 /.*/banners/.* - A simple example that uses the common combination of "." and "
2829 *" to denote any character, zero or more times. In other words, any string at
2830 all. So we start with a literal forward slash, then our regular expression
2831 pattern (".*") another literal forward slash, the string "banners", another
2832 forward slash, and lastly another ".*". We are building a directory path here.
2833 This will match any file with the path that has a directory named "banners" in
2834 it. The ".*" matches any characters, and this could conceivably be more forward
2835 slashes, so it might expand into a much longer looking path. For example, this
2836 could match: "/eye/hate/spammers/banners/annoy_me_please.gif", or just "/
2837 banners/annoying.html", or almost an infinite number of other possible
2838 combinations, just so it has "banners" in the path somewhere.
2839
2840 A now something a little more complex:
2841
2842 /.*/adv((er)?ts?|ertis(ing|ements?))?/ - We have several literal forward
2843 slashes again ("/"), so we are building another expression that is a file path
2844 statement. We have another ".*", so we are matching against any conceivable
2845 sub-path, just so it matches our expression. The only true literal that must
2846 match our pattern is adv, together with the forward slashes. What comes after
2847 the "adv" string is the interesting part.
2848
2849 Remember the "?" means the preceding expression (either a literal character or
2850 anything grouped with "(...)" in this case) can exist or not, since this means
2851 either zero or one match. So "((er)?ts?|ertis(ing|ements?))" is optional, as
2852 are the individual sub-expressions: "(er)", "(ing|ements?)", and the "s". The "
2853 |" means "or". We have two of those. For instance, "(ing|ements?)", can expand
2854 to match either "ing" OR "ements?". What is being done here, is an attempt at
2855 matching as many variations of "advertisement", and similar, as possible. So
2856 this would expand to match just "adv", or "advert", or "adverts", or
2857 "advertising", or "advertisement", or "advertisements". You get the idea. But
2858 it would not match "advertizements" (with a "z"). We could fix that by changing
2859 our regular expression to: "/.*/adv((er)?ts?|erti(s|z)(ing|ements?))?/", which
2860 would then match either spelling.
2861
2862 /.*/advert[0-9]+\.(gif|jpe?g) - Again another path statement with forward
2863 slashes. Anything in the square brackets "[]" can be matched. This is using
2864 "0-9" as a shorthand expression to mean any digit one through nine. It is the
2865 same as saying "0123456789". So any digit matches. The "+" means one or more of
2866 the preceding expression must be included. The preceding expression here is
2867 what is in the square brackets -- in this case, any digit one through nine.
2868 Then, at the end, we have a grouping: "(gif|jpe?g)". This includes a "|", so
2869 this needs to match the expression on either side of that bar character also. A
2870 simple "gif" on one side, and the other side will in turn match either "jpeg"
2871 or "jpg", since the "?" means the letter "e" is optional and can be matched
2872 once or not at all. So we are building an expression here to match image GIF or
2873 JPEG type image file. It must include the literal string "advert", then one or
2874 more digits, and a "." (which is now a literal, and not a special character,
2875 since it is escaped with "\"), and lastly either "gif", or "jpeg", or "jpg".
2876 Some possible matches would include: "//advert1.jpg", "/nasty/ads/
2877 advert1234.gif", "/banners/from/hell/advert99.jpg". It would not match
2878 "advert1.gif" (no leading slash), or "/adverts232.jpg" (the expression does not
2879 include an "s"), or "/advert1.jsp" ("jsp" is not in the expression anywhere).
2880
2881 s/microsoft(?!.com)/MicroSuck/i - This is a substitution. "MicroSuck" will
2882 replace any occurrence of "microsoft". The "i" at the end of the expression
2883 means ignore case. The "(?!.com)" means the match should fail if "microsoft" is
2884 followed by ".com". In other words, this acts like a "NOT" modifier. In case
2885 this is a hyperlink, we don't want to break it ;-).
2886
2887 We are barely scratching the surface of regular expressions here so that you
2888 can understand the default Privoxy configuration files, and maybe use this
2889 knowledge to customize your own installation. There is much, much more that can
2890 be done with regular expressions. Now that you know enough to get started, you
2891 can learn more on your own :/
2892
2893 More reading on Perl Compatible Regular expressions: http://www.perldoc.com/
2894 perl5.6/pod/perlre.html
2895
2896 -------------------------------------------------------------------------------
2897
2898 9.2. Privoxy's Internal Pages
2899
2900 Since Privoxy proxies each requested web page, it is easy for Privoxy to trap
2901 certain special URLs. In this way, we can talk directly to Privoxy, and see how
2902 it is configured, see how our rules are being applied, change these rules and
2903 other configuration options, and even turn Privoxy's filtering off, all with a
2904 web browser. 
2905
2906 The URLs listed below are the special ones that allow direct access to Privoxy.
2907 Of course, Privoxy must be running to access these. If not, you will get a
2908 friendly error message. Internet access is not necessary either.
2909
2910   * Privoxy main page:
2911    
2912         http://config.privoxy.org/
2913        
2914     Alternately, this may be reached at http://p.p/, but this variation may not
2915     work as reliably as the above in some configurations.
2916    
2917   * Show information about the current configuration:
2918    
2919         http://config.privoxy.org/show-status
2920        
2921   * Show the source code version numbers:
2922    
2923         http://config.privoxy.org/show-version
2924        
2925   * Show the client's request headers:
2926    
2927         http://config.privoxy.org/show-request
2928        
2929   * Show which actions apply to a URL and why:
2930    
2931         http://config.privoxy.org/show-url-info
2932        
2933   * Toggle Privoxy on or off. In this case, "Privoxy" continues to run, but
2934     only as a pass-through proxy, with no actions taking place:
2935    
2936         http://config.privoxy.org/toggle
2937        
2938     Short cuts. Turn off, then on:
2939    
2940         http://config.privoxy.org/toggle?set=disable
2941        
2942         http://config.privoxy.org/toggle?set=enable
2943        
2944   * Edit the actions list file:
2945    
2946         http://config.privoxy.org/edit-actions
2947        
2948 These may be bookmarked for quick reference. See next. 
2949
2950 -------------------------------------------------------------------------------
2951
2952 9.2.1. Bookmarklets
2953
2954 Below are some "bookmarklets" to allow you to easily access a "mini" version of
2955 some of Privoxy's special pages. They are designed for MS Internet Explorer,
2956 but should work equally well in Netscape, Mozilla, and other browsers which
2957 support JavaScript. They are designed to run directly from your bookmarks - not
2958 by clicking the links below (although that should work for testing).
2959
2960 To save them, right-click the link and choose "Add to Favorites" (IE) or "Add
2961 Bookmark" (Netscape). You will get a warning that the bookmark "may not be
2962 safe" - just click OK. Then you can run the Bookmarklet directly from your
2963 favorites/bookmarks. For even faster access, you can put them on the "Links"
2964 bar (IE) or the "Personal Toolbar" (Netscape), and run them with a single
2965 click.
2966
2967   * Enable Privoxy
2968    
2969   * Disable Privoxy
2970    
2971   * Toggle Privoxy (Toggles between enabled and disabled)
2972    
2973   * View Privoxy Status
2974    
2975   * Actions file feedback system
2976    
2977 Credit: The site which gave me the general idea for these bookmarklets is 
2978 www.bookmarklets.com. They have more information about bookmarklets.
2979
2980 -------------------------------------------------------------------------------
2981
2982 9.3. Chain of Events
2983
2984 Let's take a quick look at the basic sequence of events when a web page is
2985 requested by your browser and Privoxy is on duty:
2986
2987   * First, the web browser requests a page, and this request is intercepted by
2988     Privoxy immediately.
2989    
2990   * Privoxy traps any request for internal CGI pages (e.g http://p.p/) and
2991     relays these back to the browser.
2992    
2993   * If the URL matches a "+block" pattern, then it is blocked and the banner
2994     displayed.
2995    
2996   * Untrusted URLs are blocked. If URLs are being added to the trust file, then
2997     that is done.
2998    
2999   * "+fast-redirect" is processed, stripping unwanted parts of the request web
3000     page URL.
3001    
3002   * At this point, Privoxy relays the request to the web server, and requests
3003     the page (assuming nothing up to this point has prevented getting us from
3004     this far).
3005    
3006   * The first few hundred bytes are read from the web server and "+kill-popups"
3007     is processed, if enabled.
3008    
3009   * If "+filter" applies, the rest of the page is read into memory and then the
3010     filters are processed. Filters are applied in the order they are specified
3011     in the default.filter file. The entire page, which is now filtered, is then
3012     sent by Privoxy to your browser.
3013    
3014   * As the browser receives the filtered page content, it will read and request
3015     any embedded URLs on the page, e.g. an ad image. As the browser requests
3016     these secondary URLs from whatever server they may be on, Privoxy handles
3017     these same as above, and the process is repeated for each such URL. Note
3018     that a fancy web page may have many, many such URLs for graphics, frames,
3019     etc.
3020    
3021 -------------------------------------------------------------------------------
3022
3023 9.4. Anatomy of an Action
3024
3025 The way Privoxy applies "actions" and "filters" to any given URL can be
3026 complex, and not always so easy to understand what is happening. And sometimes
3027 we need to be able to see just what Privoxy is doing. Especially, if something
3028 Privoxy is doing is causing us a problem inadvertently. It can be a little
3029 daunting to look at the actions and filters files themselves, since they tend
3030 to be filled with "regular expressions" whose consequences are not always so
3031 obvious.
3032
3033 One quick test to see if Privoxy is causing a problem or not, is to disable it
3034 temporarily. This should be the first troubleshooting step. See the
3035 Bookmarklets section on a quick and easy way to do this (be sure to flush
3036 caches afterwards!).
3037
3038 Privoxy also provides the http://config.privoxy.org/show-url-info page that can
3039 show us very specifically how actions are being applied to any given URL. This
3040 is a big help for troubleshooting.
3041
3042 First, enter one URL (or partial URL) at the prompt, and then Privoxy will tell
3043 us how the current configuration will handle it. This will not help with
3044 filtering effects (i.e. the "+filter" action) from the default.filter file
3045 since this is handled very differently and not so easy to trap! It also will
3046 not tell you about any other URLs that may be embedded within the URL you are
3047 testing (i.e. a web page). For instance, images such as ads are expressed as
3048 URLs within the raw page source of HTML pages. So you will only get info for
3049 the actual URL that is pasted into the prompt area -- not any sub-URLs. If you
3050 want to know about embedded URLs like ads, you will have to dig those out of
3051 the HTML source. Use your browser's "View Page Source" option for this. Or
3052 right click on the ad, and grab the URL.
3053
3054 Let's look at an example, google.com, one section at a time:
3055
3056  System default actions:                                                       
3057                                                                                
3058  { -add-header -block -deanimate-gifs -downgrade -fast-redirects -filter       
3059    -hide-forwarded -hide-from -hide-referer -hide-user-agent -image            
3060    -image-blocker -limit-connect -no-compression -no-cookies-keep              
3061    -no-cookies-read -no-cookies-set -no-popups -vanilla-wafer -wafer }         
3062                                                                                
3063                                                                                
3064
3065 This is the top section, and only tells us of the compiled in defaults. This is
3066 basically what Privoxy would do if there were not any "actions" defined, i.e.
3067 it does nothing. Every action is disabled. This is not particularly informative
3068 for our purposes here. OK, next section:
3069
3070   Matches for http://google.com:                                               
3071                                                                                
3072  { -add-header -block +deanimate-gifs -downgrade +fast-redirects               
3073    +filter{html-annoyances} +filter{js-annoyances} +filter{no-popups}          
3074    +filter{webbugs} +filter{nimda} +filter{banners-by-size} +filter{hal}       
3075    +filter{fun} +hide-forwarded +hide-from{block} +hide-referer{forge}         
3076    -hide-user-agent -image +image-blocker{blank} +no-compression               
3077    +no-cookies-keep -no-cookies-read -no-cookies-set +no-popups                
3078    -vanilla-wafer -wafer }                                                     
3079    /                                                                           
3080                                                                                
3081  { -no-cookies-keep -no-cookies-read -no-cookies-set }                         
3082   .google.com                                                                  
3083                                                                                
3084  { -fast-redirects }                                                           
3085   .google.com                                                                  
3086                                                                                
3087                                                                                
3088
3089 This is much more informative, and tells us how we have defined our "actions",
3090 and which ones match for our example, "google.com". The first grouping shows
3091 our default settings, which would apply to all URLs. If you look at your
3092 "actions" file, this would be the section just below the "aliases" section near
3093 the top. This applies to all URLs as signified by the single forward slash -- "
3094 /".
3095
3096 These are the default actions we have enabled. But we can define additional
3097 actions that would be exceptions to these general rules, and then list specific
3098 URLs that these exceptions would apply to. Last match wins. Just below this
3099 then are two explicit matches for ".google.com". The first is negating our
3100 various cookie blocking actions (i.e. we will allow cookies here). The second
3101 is allowing "fast-redirects". Note that there is a leading dot here --
3102 ".google.com". This will match any hosts and sub-domains, in the google.com
3103 domain also, such as "www.google.com". So, apparently, we have these actions
3104 defined somewhere in the lower part of our actions file, and "google.com" is
3105 referenced in these sections. 
3106
3107 And now we pull it altogether in the bottom section and summarize how Privoxy
3108 is applying all its "actions" to "google.com": 
3109
3110   Final results:                                                               
3111                                                                                
3112  -add-header -block -deanimate-gifs -downgrade -fast-redirects                 
3113  +filter{html-annoyances} +filter{js-annoyances} +filter{no-popups}            
3114  +filter{webbugs} +filter{nimda} +filter{banners-by-size} +filter{hal}         
3115  +filter{fun} +hide-forwarded +hide-from{block} +hide-referer{forge}           
3116  -hide-user-agent -image +image-blocker{blank} -limit-connect +no-compression  
3117  -no-cookies-keep -no-cookies-read -no-cookies-set +no-popups -vanilla-wafer   
3118  -wafer                                                                        
3119                                                                                
3120                                                                                
3121
3122 Now another example, "ad.doubleclick.net":
3123
3124   { +block +image }                                                            
3125   .ad.doubleclick.net                                                          
3126                                                                                
3127  { +block +image }                                                             
3128   ad*.                                                                         
3129                                                                                
3130  { +block +image }                                                             
3131   .doubleclick.net                                                             
3132                                                                                
3133                                                                                
3134
3135 We'll just show the interesting part here, the explicit matches. It is matched
3136 three different times. Each as an "+block +image", which is the expanded form
3137 of one of our aliases that had been defined as: "+imageblock". ("Aliases" are
3138 defined in the first section of the actions file and typically used to combine
3139 more than one action.)
3140
3141 Any one of these would have done the trick and blocked this as an unwanted
3142 image. This is unnecessarily redundant since the last case effectively would
3143 also cover the first. No point in taking chances with these guys though ;-)
3144 Note that if you want an ad or obnoxious URL to be invisible, it should be
3145 defined as "ad.doubleclick.net" is done here -- as both a "+block" and an
3146 "+image". The custom alias "+imageblock" does this for us.
3147
3148 One last example. Let's try "http://www.rhapsodyk.net/adsl/HOWTO/". This one is
3149 giving us problems. We are getting a blank page. Hmmm...
3150
3151   Matches for http://www.rhapsodyk.net/adsl/HOWTO/:                            
3152                                                                                
3153  { -add-header -block +deanimate-gifs -downgrade +fast-redirects               
3154    +filter{html-annoyances} +filter{js-annoyances} +filter{no-popups}          
3155    +filter{webbugs} +filter{nimda} +filter{banners-by-size} +filter{hal}       
3156    +filter{fun} +hide-forwarded +hide-from{block} +hide-referer{forge}         
3157    -hide-user-agent -image +image-blocker{blank} +no-compression               
3158    +no-cookies-keep -no-cookies-read -no-cookies-set +no-popups                
3159    -vanilla-wafer -wafer }                                                     
3160    /                                                                           
3161                                                                                
3162  { +block +image }                                                             
3163   /ads                                                                         
3164                                                                                
3165                                                                                
3166
3167 Ooops, the "/adsl/" is matching "/ads"! But we did not want this at all! Now we
3168 see why we get the blank page. We could now add a new action below this that
3169 explicitly does not block (-block) pages with "adsl". There are various ways to
3170 handle such exceptions. Example:
3171
3172   { -block }                                                                   
3173   /adsl                                                                        
3174                                                                                
3175                                                                                
3176
3177 Now the page displays ;-) Be sure to flush your browser's caches when making
3178 such changes. Or, try using Shift+Reload.
3179
3180 But now what about a situation where we get no explicit matches like we did
3181 with:
3182
3183   { -block }                                                                   
3184   /adsl                                                                        
3185                                                                                
3186                                                                                
3187
3188 That actually was very telling and pointed us quickly to where the problem was.
3189 If you don't get this kind of match, then it means one of the default rules in
3190 the first section is causing the problem. This would require some guesswork,
3191 and maybe a little trial and error to isolate the offending rule. One likely
3192 cause would be one of the "{+filter}" actions. Try adding the URL for the site
3193 to one of aliases that turn off "+filter":
3194
3195   {shop}                                                                       
3196  .quietpc.com                                                                  
3197  .worldpay.com   # for quietpc.com                                             
3198  .jungle.com                                                                   
3199  .scan.co.uk                                                                   
3200  .forbes.com                                                                   
3201                                                                                
3202                                                                                
3203
3204 "{shop}" is an "alias" that expands to "{ -filter -no-cookies -no-cookies-keep
3205 }". Or you could do your own exception to negate filtering: 
3206
3207   {-filter}                                                                    
3208  .forbes.com                                                                   
3209                                                                                
3210                                                                                
3211
3212 "{fragile}" is an alias that disables most actions. This can be used as a last
3213 resort for problem sites. Remember to flush caches! If this still does not
3214 work, you will have to go through the remaining actions one by one to find
3215 which one(s) is causing the problem.
3216