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