1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
5 <title>Actions Files</title>
6 <meta name="GENERATOR" content=
7 "Modular DocBook HTML Stylesheet Version 1.79">
8 <link rel="HOME" title="Privoxy 3.0.26 User Manual" href="index.html">
9 <link rel="PREVIOUS" title="The Main Configuration File" href=
11 <link rel="NEXT" title="Filter Files" href="filter-file.html">
12 <link rel="STYLESHEET" type="text/css" href="../p_doc.css">
13 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
14 <link rel="STYLESHEET" type="text/css" href="p_doc.css">
16 <body class="SECT1" bgcolor="#EEEEEE" text="#000000" link="#0000FF" vlink=
17 "#840084" alink="#0000FF">
18 <div class="NAVHEADER">
19 <table summary="Header navigation table" width="100%" border="0"
20 cellpadding="0" cellspacing="0">
22 <th colspan="3" align="center">Privoxy 3.0.26 User Manual</th>
25 <td width="10%" align="left" valign="bottom"><a href="config.html"
26 accesskey="P">Prev</a></td>
27 <td width="80%" align="center" valign="bottom"></td>
28 <td width="10%" align="right" valign="bottom"><a href=
29 "filter-file.html" accesskey="N">Next</a></td>
32 <hr align="left" width="100%">
35 <h1 class="SECT1"><a name="ACTIONS-FILE" id="ACTIONS-FILE">8. Actions
37 <p>The actions files are used to define what <span class=
38 "emphasis"><i class="EMPHASIS">actions</i></span> <span class=
39 "APPLICATION">Privoxy</span> takes for which URLs, and thus determines
40 how ad images, cookies and various other aspects of HTTP content and
41 transactions are handled, and on which sites (or even parts thereof).
42 There are a number of such actions, with a wide range of functionality.
43 Each action does something a little different. These actions give us a
44 veritable arsenal of tools with which to exert our control, preferences
45 and independence. Actions can be combined so that their effects are
46 aggregated when applied against a given set of URLs.</p>
47 <p>There are three action files included with <span class=
48 "APPLICATION">Privoxy</span> with differing purposes:</p>
51 <p><tt class="FILENAME">match-all.action</tt> - is used to define
52 which <span class="QUOTE">"actions"</span> relating to
53 banner-blocking, images, pop-ups, content modification, cookie
54 handling etc should be applied by default. It should be the first
55 actions file loaded</p>
58 <p><tt class="FILENAME">default.action</tt> - defines many exceptions
59 (both positive and negative) from the default set of actions that's
60 configured in <tt class="FILENAME">match-all.action</tt>. It is a set
61 of rules that should work reasonably well as-is for most users. This
62 file is only supposed to be edited by the developers. It should be
63 the second actions file loaded.</p>
66 <p><tt class="FILENAME">user.action</tt> - is intended to be for
67 local site preferences and exceptions. As an example, if your ISP or
68 your bank has specific requirements, and need special handling, this
69 kind of thing should go here. This file will not be upgraded.</p>
72 <p><span class="GUIBUTTON">Edit</span> <span class="GUIBUTTON">Set to
73 Cautious</span> <span class="GUIBUTTON">Set to Medium</span>
74 <span class="GUIBUTTON">Set to Advanced</span></p>
75 <p>These have increasing levels of aggressiveness <span class=
76 "emphasis"><i class="EMPHASIS">and have no influence on your browsing
77 unless you select them explicitly in the editor</i></span>. A default
78 installation should be pre-set to <tt class="LITERAL">Cautious</tt>.
79 New users should try this for a while before adjusting the settings
80 to more aggressive levels. The more aggressive the settings, then the
81 more likelihood there is of problems such as sites not working as
83 <p>The <span class="GUIBUTTON">Edit</span> button allows you to turn
84 each action on/off individually for fine-tuning. The <span class=
85 "GUIBUTTON">Cautious</span> button changes the actions list to
86 low/safe settings which will activate ad blocking and a minimal set
87 of <span class="APPLICATION">Privoxy</span>'s features, and
88 subsequently there will be less of a chance for accidental problems.
89 The <span class="GUIBUTTON">Medium</span> button sets the list to a
90 medium level of other features and a low level set of privacy
91 features. The <span class="GUIBUTTON">Advanced</span> button sets the
92 list to a high level of ad blocking and medium level of privacy. See
93 the chart below. The latter three buttons over-ride any changes via
94 with the <span class="GUIBUTTON">Edit</span> button. More fine-tuning
95 can be done in the lower sections of this internal page.</p>
96 <p>While the actions file editor allows to enable these settings in
97 all actions files, they are only supposed to be enabled in the first
98 one to make sure you don't unintentionally overrule earlier
100 <p>The default profiles, and their associated actions, as pre-defined
101 in <tt class="FILENAME">default.action</tt> are:</p>
103 <a name="AEN2791" id="AEN2791"></a>
104 <p><b>Table 1. Default Configurations</b></p>
105 <table border="1" frame="border" rules="all" class="CALSTABLE">
106 <col width="1*" title="C1">
107 <col width="1*" title="C2">
108 <col width="1*" title="C3">
109 <col width="1*" title="C4">
120 <td>Ad-blocking Aggressiveness</td>
126 <td>Ad-filtering by size</td>
132 <td>Ad-filtering by link</td>
138 <td>Pop-up killing</td>
144 <td>Privacy Features</td>
150 <td>Cookie handling</td>
152 <td>session-only</td>
156 <td>Referer forging</td>
162 <td>GIF de-animation</td>
168 <td>Fast redirects</td>
180 <td>JavaScript taming</td>
186 <td>Web-bug killing</td>
192 <td>Image tag reordering</td>
202 <p>The list of actions files to be used are defined in the main
203 configuration file, and are processed in the order they are defined (e.g.
204 <tt class="FILENAME">default.action</tt> is typically processed before
205 <tt class="FILENAME">user.action</tt>). The content of these can all be
206 viewed and edited from <a href="http://config.privoxy.org/show-status"
207 target="_top">http://config.privoxy.org/show-status</a>. The over-riding
208 principle when applying actions, is that the last action that matches a
209 given URL wins. The broadest, most general rules go first (defined in
210 <tt class="FILENAME">default.action</tt>), followed by any exceptions
211 (typically also in <tt class="FILENAME">default.action</tt>), which are
212 then followed lastly by any local preferences (typically in <span class=
213 "emphasis"><i class="EMPHASIS">user</i></span><tt class=
214 "FILENAME">.action</tt>). Generally, <tt class=
215 "FILENAME">user.action</tt> has the last word.</p>
216 <p>An actions file typically has multiple sections. If you want to use
217 <span class="QUOTE">"aliases"</span> in an actions file, you have to
218 place the (optional) <a href="actions-file.html#ALIASES">alias
219 section</a> at the top of that file. Then comes the default set of rules
220 which will apply universally to all sites and pages (be <span class=
221 "emphasis"><i class="EMPHASIS">very careful</i></span> with using such a
222 universal set in <tt class="FILENAME">user.action</tt> or any other
223 actions file after <tt class="FILENAME">default.action</tt>, because it
224 will override the result from consulting any previous file). And then
225 below that, exceptions to the defined universal policies. You can regard
226 <tt class="FILENAME">user.action</tt> as an appendix to <tt class=
227 "FILENAME">default.action</tt>, with the advantage that it is a separate
228 file, which makes preserving your personal settings across <span class=
229 "APPLICATION">Privoxy</span> upgrades easier.</p>
230 <p>Actions can be used to block anything you want, including ads,
231 banners, or just some obnoxious URL whose content you would rather not
232 see. Cookies can be accepted or rejected, or accepted only during the
233 current browser session (i.e. not written to disk), content can be
234 modified, some JavaScripts tamed, user-tracking fooled, and much more.
235 See below for a <a href="actions-file.html#ACTIONS">complete list of
238 <h2 class="SECT2"><a name="RIGHT-MIX" id="RIGHT-MIX">8.1. Finding the
240 <p>Note that some <a href="actions-file.html#ACTIONS">actions</a>, like
241 cookie suppression or script disabling, may render some sites unusable
242 that rely on these techniques to work properly. Finding the right mix
243 of actions is not always easy and certainly a matter of personal taste.
244 And, things can always change, requiring refinements in the
245 configuration. In general, it can be said that the more <span class=
246 "QUOTE">"aggressive"</span> your default settings (in the top section
247 of the actions file) are, the more exceptions for <span class=
248 "QUOTE">"trusted"</span> sites you will have to make later. If, for
249 example, you want to crunch all cookies per default, you'll have to
250 make exceptions from that rule for sites that you regularly use and
251 that require cookies for actually useful purposes, like maybe your
252 bank, favorite shop, or newspaper.</p>
253 <p>We have tried to provide you with reasonable rules to start from in
254 the distribution actions files. But there is no general rule of thumb
255 on these things. There just are too many variables, and sites are
256 constantly changing. Sooner or later you will want to change the rules
257 (and read this chapter again :).</p>
260 <h2 class="SECT2"><a name="HOW-TO-EDIT" id="HOW-TO-EDIT">8.2. How to
262 <p>The easiest way to edit the actions files is with a browser by using
263 our browser-based editor, which can be reached from <a href=
264 "http://config.privoxy.org/show-status" target=
265 "_top">http://config.privoxy.org/show-status</a>. Note: the config file
267 "config.html#ENABLE-EDIT-ACTIONS">enable-edit-actions</a> must be
268 enabled for this to work. The editor allows both fine-grained control
269 over every single feature on a per-URL basis, and easy choosing from
270 wholesale sets of defaults like <span class="QUOTE">"Cautious"</span>,
271 <span class="QUOTE">"Medium"</span> or <span class=
272 "QUOTE">"Advanced"</span>. Warning: the <span class=
273 "QUOTE">"Advanced"</span> setting is more aggressive, and will be more
274 likely to cause problems for some sites. Experienced users only!</p>
275 <p>If you prefer plain text editing to GUIs, you can of course also
276 directly edit the the actions files with your favorite text editor.
277 Look at <tt class="FILENAME">default.action</tt> which is richly
278 commented with many good examples.</p>
281 <h2 class="SECT2"><a name="ACTIONS-APPLY" id="ACTIONS-APPLY">8.3. How
282 Actions are Applied to Requests</a></h2>
283 <p>Actions files are divided into sections. There are special sections,
284 like the <span class="QUOTE">"<a href=
285 "actions-file.html#ALIASES">alias</a>"</span> sections which will be
286 discussed later. For now let's concentrate on regular sections: They
287 have a heading line (often split up to multiple lines for readability)
288 which consist of a list of actions, separated by whitespace and
289 enclosed in curly braces. Below that, there is a list of URL and tag
290 patterns, each on a separate line.</p>
291 <p>To determine which actions apply to a request, the URL of the
292 request is compared to all URL patterns in each <span class=
293 "QUOTE">"action file"</span>. Every time it matches, the list of
294 applicable actions for the request is incrementally updated, using the
295 heading of the section in which the pattern is located. The same is
296 done again for tags and tag patterns later on.</p>
297 <p>If multiple applying sections set the same action differently, the
298 last match wins. If not, the effects are aggregated. E.g. a URL might
299 match a regular section with a heading line of <tt class="LITERAL">{
300 +<a href="actions-file.html#HANDLE-AS-IMAGE">handle-as-image</a>
301 }</tt>, then later another one with just <tt class="LITERAL">{
302 +<a href="actions-file.html#BLOCK">block</a> }</tt>, resulting in
303 <span class="emphasis"><i class="EMPHASIS">both</i></span> actions to
304 apply. And there may well be cases where you will want to combine
305 actions together. Such a section then might look like:</p>
306 <table border="0" bgcolor="#E0E0E0" width="100%">
309 <pre class="SCREEN"> { +<tt class=
310 "LITERAL">handle-as-image</tt> +<tt class=
311 "LITERAL">block{Banner ads.}</tt> }
312 # Block these as if they were images. Send no block page.
314 media.example.com/.*banners
315 .example.com/images/ads/</pre>
319 <p>You can trace this process for URL patterns and any given URL by
320 visiting <a href="http://config.privoxy.org/show-url-info" target=
321 "_top">http://config.privoxy.org/show-url-info</a>.</p>
322 <p>Examples and more detail on this is provided in the Appendix,
323 <a href="appendix.html#ACTIONSANAT">Troubleshooting: Anatomy of an
324 Action</a> section.</p>
327 <h2 class="SECT2"><a name="AF-PATTERNS" id="AF-PATTERNS">8.4.
329 <p>As mentioned, <span class="APPLICATION">Privoxy</span> uses
330 <span class="QUOTE">"patterns"</span> to determine what <span class=
331 "emphasis"><i class="EMPHASIS">actions</i></span> might apply to which
332 sites and pages your browser attempts to access. These <span class=
333 "QUOTE">"patterns"</span> use wild card type <span class=
334 "emphasis"><i class="EMPHASIS">pattern</i></span> matching to achieve a
335 high degree of flexibility. This allows one expression to be expanded
336 and potentially match against many similar patterns.</p>
337 <p>Generally, an URL pattern has the form <tt class=
338 "LITERAL"><host><port>/<path></tt>, where the
339 <tt class="LITERAL"><host></tt>, the <tt class=
340 "LITERAL"><port></tt> and the <tt class=
341 "LITERAL"><path></tt> are optional. (This is why the special
342 <tt class="LITERAL">/</tt> pattern matches all URLs). Note that the
343 protocol portion of the URL pattern (e.g. <tt class=
344 "LITERAL">http://</tt>) should <span class="emphasis"><i class=
345 "EMPHASIS">not</i></span> be included in the pattern. This is assumed
347 <p>The pattern matching syntax is different for the host and path parts
348 of the URL. The host part uses a simple globbing type matching
349 technique, while the path part uses more flexible <a href=
350 "http://en.wikipedia.org/wiki/Regular_expressions" target=
351 "_top"><span class="QUOTE">"Regular Expressions"</span></a> (POSIX
353 <p>The port part of a pattern is a decimal port number preceded by a
354 colon (<tt class="LITERAL">:</tt>). If the host part contains a
355 numerical IPv6 address, it has to be put into angle brackets
356 (<tt class="LITERAL"><</tt>, <tt class="LITERAL">></tt>).</p>
357 <div class="VARIABLELIST">
359 <dt><tt class="LITERAL">www.example.com/</tt></dt>
361 <p>is a host-only pattern and will match any request to
362 <tt class="LITERAL">www.example.com</tt>, regardless of which
363 document on that server is requested. So ALL pages in this domain
364 would be covered by the scope of this action. Note that a simple
365 <tt class="LITERAL">example.com</tt> is different and would NOT
368 <dt><tt class="LITERAL">www.example.com</tt></dt>
370 <p>means exactly the same. For host-only patterns, the trailing
371 <tt class="LITERAL">/</tt> may be omitted.</p>
373 <dt><tt class="LITERAL">www.example.com/index.html</tt></dt>
375 <p>matches all the documents on <tt class=
376 "LITERAL">www.example.com</tt> whose name starts with <tt class=
377 "LITERAL">/index.html</tt>.</p>
379 <dt><tt class="LITERAL">www.example.com/index.html$</tt></dt>
381 <p>matches only the single document <tt class=
382 "LITERAL">/index.html</tt> on <tt class=
383 "LITERAL">www.example.com</tt>.</p>
385 <dt><tt class="LITERAL">/index.html$</tt></dt>
387 <p>matches the document <tt class="LITERAL">/index.html</tt>,
388 regardless of the domain, i.e. on <span class=
389 "emphasis"><i class="EMPHASIS">any</i></span> web server
392 <dt><tt class="LITERAL">/</tt></dt>
394 <p>Matches any URL because there's no requirement for either the
395 domain or the path to match anything.</p>
397 <dt><tt class="LITERAL">:8000/</tt></dt>
399 <p>Matches any URL pointing to TCP port 8000.</p>
401 <dt><tt class="LITERAL">10.0.0.1/</tt></dt>
403 <p>Matches any URL with the host address <tt class=
404 "LITERAL">10.0.0.1</tt>. (Note that the real URL uses plain
405 brackets, not angle brackets.)</p>
407 <dt><tt class="LITERAL"><2001:db8::1>/</tt></dt>
409 <p>Matches any URL with the host address <tt class=
410 "LITERAL">2001:db8::1</tt>. (Note that the real URL uses plain
411 brackets, not angle brackets.)</p>
413 <dt><tt class="LITERAL">index.html</tt></dt>
415 <p>matches nothing, since it would be interpreted as a domain
416 name and there is no top-level domain called <tt class=
417 "LITERAL">.html</tt>. So its a mistake.</p>
422 <h3 class="SECT3"><a name="HOST-PATTERN" id="HOST-PATTERN">8.4.1. The
423 Host Pattern</a></h3>
424 <p>The matching of the host part offers some flexible options: if the
425 host pattern starts or ends with a dot, it becomes unanchored at that
426 end. The host pattern is often referred to as domain pattern as it is
427 usually used to match domain names and not IP addresses. For
429 <div class="VARIABLELIST">
431 <dt><tt class="LITERAL">.example.com</tt></dt>
433 <p>matches any domain with first-level domain <tt class=
434 "LITERAL">com</tt> and second-level domain <tt class=
435 "LITERAL">example</tt>. For example <tt class=
436 "LITERAL">www.example.com</tt>, <tt class=
437 "LITERAL">example.com</tt> and <tt class=
438 "LITERAL">foo.bar.baz.example.com</tt>. Note that it wouldn't
439 match if the second-level domain was <tt class=
440 "LITERAL">another-example</tt>.</p>
442 <dt><tt class="LITERAL">www.</tt></dt>
444 <p>matches any domain that <span class="emphasis"><i class=
445 "EMPHASIS">STARTS</i></span> with <tt class="LITERAL">www.</tt>
446 (It also matches the domain <tt class="LITERAL">www</tt> but
447 most of the time that doesn't matter.)</p>
449 <dt><tt class="LITERAL">.example.</tt></dt>
451 <p>matches any domain that <span class="emphasis"><i class=
452 "EMPHASIS">CONTAINS</i></span> <tt class=
453 "LITERAL">.example.</tt>. And, by the way, also included would
454 be any files or documents that exist within that domain since
455 no path limitations are specified. (Correctly speaking: It
456 matches any FQDN that contains <tt class="LITERAL">example</tt>
457 as a domain.) This might be <tt class=
458 "LITERAL">www.example.com</tt>, <tt class=
459 "LITERAL">news.example.de</tt>, or <tt class=
460 "LITERAL">www.example.net/cgi/testing.pl</tt> for instance. All
461 these cases are matched.</p>
465 <p>Additionally, there are wild-cards that you can use in the domain
466 names themselves. These work similarly to shell globbing type
467 wild-cards: <span class="QUOTE">"*"</span> represents zero or more
468 arbitrary characters (this is equivalent to the <a href=
469 "http://en.wikipedia.org/wiki/Regular_expressions" target=
470 "_top"><span class="QUOTE">"Regular Expression"</span></a> based
471 syntax of <span class="QUOTE">".*"</span>), <span class=
472 "QUOTE">"?"</span> represents any single character (this is
473 equivalent to the regular expression syntax of a simple <span class=
474 "QUOTE">"."</span>), and you can define <span class=
475 "QUOTE">"character classes"</span> in square brackets which is
476 similar to the same regular expression technique. All of this can be
478 <div class="VARIABLELIST">
480 <dt><tt class="LITERAL">ad*.example.com</tt></dt>
482 <p>matches <span class="QUOTE">"adserver.example.com"</span>,
483 <span class="QUOTE">"ads.example.com"</span>, etc but not
484 <span class="QUOTE">"sfads.example.com"</span></p>
486 <dt><tt class="LITERAL">*ad*.example.com</tt></dt>
488 <p>matches all of the above, and then some.</p>
490 <dt><tt class="LITERAL">.?pix.com</tt></dt>
492 <p>matches <tt class="LITERAL">www.ipix.com</tt>, <tt class=
493 "LITERAL">pictures.epix.com</tt>, <tt class=
494 "LITERAL">a.b.c.d.e.upix.com</tt> etc.</p>
496 <dt><tt class="LITERAL">www[1-9a-ez].example.c*</tt></dt>
498 <p>matches <tt class="LITERAL">www1.example.com</tt>,
499 <tt class="LITERAL">www4.example.cc</tt>, <tt class=
500 "LITERAL">wwwd.example.cy</tt>, <tt class=
501 "LITERAL">wwwz.example.com</tt> etc., but <span class=
502 "emphasis"><i class="EMPHASIS">not</i></span> <tt class=
503 "LITERAL">wwww.example.com</tt>.</p>
507 <p>While flexible, this is not the sophistication of full regular
508 expression based syntax.</p>
511 <h3 class="SECT3"><a name="PATH-PATTERN" id="PATH-PATTERN">8.4.2. The
512 Path Pattern</a></h3>
513 <p><span class="APPLICATION">Privoxy</span> uses <span class=
514 "QUOTE">"modern"</span> POSIX 1003.2 <a href=
515 "http://en.wikipedia.org/wiki/Regular_expressions" target=
516 "_top"><span class="QUOTE">"Regular Expressions"</span></a> for
517 matching the path portion (after the slash), and is thus more
519 <p>There is an <a href="appendix.html#REGEX">Appendix</a> with a
520 brief quick-start into regular expressions, you also might want to
521 have a look at your operating system's documentation on regular
522 expressions (try <tt class="LITERAL">man re_format</tt>).</p>
523 <p>Note that the path pattern is automatically left-anchored at the
524 <span class="QUOTE">"/"</span>, i.e. it matches as if it would start
525 with a <span class="QUOTE">"^"</span> (regular expression speak for
526 the beginning of a line).</p>
527 <p>Please also note that matching in the path is <span class=
528 "emphasis"><i class="EMPHASIS">CASE INSENSITIVE</i></span> by
529 default, but you can switch to case sensitive at any point in the
530 pattern by using the <span class="QUOTE">"(?-i)"</span> switch:
531 <tt class="LITERAL">www.example.com/(?-i)PaTtErN.*</tt> will match
532 only documents whose path starts with <tt class=
533 "LITERAL">PaTtErN</tt> in <span class="emphasis"><i class=
534 "EMPHASIS">exactly</i></span> this capitalization.</p>
535 <div class="VARIABLELIST">
537 <dt><tt class="LITERAL">.example.com/.*</tt></dt>
539 <p>Is equivalent to just <span class=
540 "QUOTE">".example.com"</span>, since any documents within that
541 domain are matched with or without the <span class=
542 "QUOTE">".*"</span> regular expression. This is redundant</p>
544 <dt><tt class="LITERAL">.example.com/.*/index.html$</tt></dt>
546 <p>Will match any page in the domain of <span class=
547 "QUOTE">"example.com"</span> that is named <span class=
548 "QUOTE">"index.html"</span>, and that is part of some path. For
549 example, it matches <span class=
550 "QUOTE">"www.example.com/testing/index.html"</span> but NOT
551 <span class="QUOTE">"www.example.com/index.html"</span> because
552 the regular expression called for at least two <span class=
553 "QUOTE">"/'s"</span>, thus the path requirement. It also would
555 "QUOTE">"www.example.com/testing/index_html"</span>, because of
556 the special meta-character <span class="QUOTE">"."</span>.</p>
558 <dt><tt class="LITERAL">.example.com/(.*/)?index\.html$</tt></dt>
560 <p>This regular expression is conditional so it will match any
561 page named <span class="QUOTE">"index.html"</span> regardless
562 of path which in this case can have one or more <span class=
563 "QUOTE">"/'s"</span>. And this one must contain exactly
564 <span class="QUOTE">".html"</span> (but does not have to end
568 "LITERAL">.example.com/(.*/)(ads|banners?|junk)</tt></dt>
570 <p>This regular expression will match any path of <span class=
571 "QUOTE">"example.com"</span> that contains any of the words
572 <span class="QUOTE">"ads"</span>, <span class=
573 "QUOTE">"banner"</span>, <span class="QUOTE">"banners"</span>
574 (because of the <span class="QUOTE">"?"</span>) or <span class=
575 "QUOTE">"junk"</span>. The path does not have to end in these
576 words, just contain them.</p>
579 "LITERAL">.example.com/(.*/)(ads|banners?|junk)/.*\.(jpe?g|gif|png)$</tt></dt>
581 <p>This is very much the same as above, except now it must end
582 in either <span class="QUOTE">".jpg"</span>, <span class=
583 "QUOTE">".jpeg"</span>, <span class="QUOTE">".gif"</span> or
584 <span class="QUOTE">".png"</span>. So this one is limited to
585 common image formats.</p>
589 <p>There are many, many good examples to be found in <tt class=
590 "FILENAME">default.action</tt>, and more tutorials below in <a href=
591 "appendix.html#REGEX">Appendix on regular expressions</a>.</p>
594 <h3 class="SECT3"><a name="TAG-PATTERN" id="TAG-PATTERN">8.4.3. The
595 Request Tag Pattern</a></h3>
596 <p>Request tag patterns are used to change the applying actions based
597 on the request's tags. Tags can be created based on HTTP headers with
599 "actions-file.html#CLIENT-HEADER-TAGGER">client-header-tagger</a> or
601 "actions-file.html#SERVER-HEADER-TAGGER">server-header-tagger</a>
603 <p>Request tag patterns have to start with <span class=
604 "QUOTE">"TAG:"</span>, so <span class="APPLICATION">Privoxy</span>
605 can tell them apart from other patterns. Everything after the colon
606 including white space, is interpreted as a regular expression with
607 path pattern syntax, except that tag patterns aren't left-anchored
608 automatically (<span class="APPLICATION">Privoxy</span> doesn't
609 silently add a <span class="QUOTE">"^"</span>, you have to do it
610 yourself if you need it).</p>
611 <p>To match all requests that are tagged with <span class=
612 "QUOTE">"foo"</span> your pattern line should be <span class=
613 "QUOTE">"TAG:^foo$"</span>, <span class="QUOTE">"TAG:foo"</span>
614 would work as well, but it would also match requests whose tags
615 contain <span class="QUOTE">"foo"</span> somewhere. <span class=
616 "QUOTE">"TAG: foo"</span> wouldn't work as it requires white
618 <p>Sections can contain URL and request tag patterns at the same
619 time, but request tag patterns are checked after the URL patterns and
620 thus always overrule them, even if they are located before the URL
622 <p>Once a new request tag is added, Privoxy checks right away if it's
623 matched by one of the request tag patterns and updates the action
624 settings accordingly. As a result request tags can be used to
625 activate other tagger actions, as long as these other taggers look
626 for headers that haven't already be parsed.</p>
627 <p>For example you could tag client requests which use the <tt class=
628 "LITERAL">POST</tt> method, then use this tag to activate another
629 tagger that adds a tag if cookies are sent, and then use a block
630 action based on the cookie tag. This allows the outcome of one
631 action, to be input into a subsequent action. However if you'd
632 reverse the position of the described taggers, and activated the
633 method tagger based on the cookie tagger, no method tags would be
634 created. The method tagger would look for the request line, but at
635 the time the cookie tag is created, the request line has already been
637 <p>While this is a limitation you should be aware of, this kind of
638 indirection is seldom needed anyway and even the example doesn't make
642 <h3 class="SECT3"><a name="NEGATIVE-TAG-PATTERNS" id=
643 "NEGATIVE-TAG-PATTERNS">8.4.4. The Negative Request Tag
645 <p>To match requests that do not have a certain request tag, specify
646 a negative tag pattern by prefixing the tag pattern line with either
647 <span class="QUOTE">"NO-REQUEST-TAG:"</span> or <span class=
648 "QUOTE">"NO-RESPONSE-TAG:"</span> instead of <span class=
649 "QUOTE">"TAG:"</span>.</p>
650 <p>Negative request tag patterns created with <span class=
651 "QUOTE">"NO-REQUEST-TAG:"</span> are checked after all client headers
652 are scanned, the ones created with <span class=
653 "QUOTE">"NO-RESPONSE-TAG:"</span> are checked after all server
654 headers are scanned. In both cases all the created tags are
658 <h3 class="SECT3"><a name="CLIENT-TAG-PATTERN" id=
659 "CLIENT-TAG-PATTERN">8.4.5. The Client Tag Pattern</a></h3>
660 <div class="WARNING">
661 <table class="WARNING" border="1" width="100%">
663 <td align="center"><b>Warning</b></td>
667 <p>This is an experimental feature. The syntax is likely to
668 change in future versions.</p>
673 <p>Client tag patterns are not set based on HTTP headers but based on
674 the client's IP address. Users can enable them themselves, but the
675 Privoxy admin controls which tags are available and what their effect
677 <p>After a client-specific tag has been defined with the <a href=
678 "config.html#CLIENT-SPECIFIC-TAG">client-specific-tag</a>, directive,
679 action sections can be activated based on the tag by using a
680 CLIENT-TAG pattern. The CLIENT-TAG pattern is evaluated at the same
681 priority as URL patterns, as a result the last matching pattern wins.
682 Tags that are created based on client or server headers are evaluated
683 later on and can overrule CLIENT-TAG and URL patterns!</p>
684 <p>The tag is set for all requests that come from clients that
685 requested it to be set. Note that "clients" are differentiated by IP
686 address, if the IP address changes the tag has to be requested
688 <p>Clients can request tags to be set by using the CGI interface
689 <a href="http://config.privoxy.org/client-tags" target=
690 "_top">http://config.privoxy.org/client-tags</a>.</p>
692 <table border="0" bgcolor="#E0E0E0" width="100%">
696 # If the admin defined the client-specific-tag circumvent-blocks,
697 # and the request comes from a client that previously requested
698 # the tag to be set, overrule all previous +block actions that
699 # are enabled based on URL to CLIENT-TAG patterns.
701 CLIENT-TAG:^circumvent-blocks$
703 # This section is not overruled because it's located after
705 {+block{Nobody is supposed to request this.}}
706 example.org/blocked-example-page</pre>
713 <h2 class="SECT2"><a name="ACTIONS" id="ACTIONS">8.5. Actions</a></h2>
714 <p>All actions are disabled by default, until they are explicitly
715 enabled somewhere in an actions file. Actions are turned on if preceded
716 with a <span class="QUOTE">"+"</span>, and turned off if preceded with
717 a <span class="QUOTE">"-"</span>. So a <tt class="LITERAL">+action</tt>
718 means <span class="QUOTE">"do that action"</span>, e.g. <tt class=
719 "LITERAL">+block</tt> means <span class="QUOTE">"please block URLs that
720 match the following patterns"</span>, and <tt class=
721 "LITERAL">-block</tt> means <span class="QUOTE">"don't block URLs that
722 match the following patterns, even if <tt class="LITERAL">+block</tt>
723 previously applied."</span></p>
724 <p>Again, actions are invoked by placing them on a line, enclosed in
725 curly braces and separated by whitespace, like in <tt class=
726 "LITERAL">{+some-action -some-other-action{some-parameter}}</tt>,
727 followed by a list of URL patterns, one per line, to which they apply.
728 Together, the actions line and the following pattern lines make up a
729 section of the actions file.</p>
730 <p>Actions fall into three categories:</p>
733 <p>Boolean, i.e the action can only be <span class=
734 "QUOTE">"enabled"</span> or <span class="QUOTE">"disabled"</span>.
736 <table border="0" bgcolor="#E0E0E0" width="90%">
739 <pre class="SCREEN"> +<tt class=
740 "REPLACEABLE"><i>name</i></tt> # enable action <tt class=
741 "REPLACEABLE"><i>name</i></tt>
743 "REPLACEABLE"><i>name</i></tt> # disable action <tt class="REPLACEABLE"><i>name</i></tt></pre>
747 <p>Example: <tt class="LITERAL">+handle-as-image</tt></p>
750 <p>Parameterized, where some value is required in order to enable
751 this type of action. Syntax:</p>
752 <table border="0" bgcolor="#E0E0E0" width="90%">
755 <pre class="SCREEN"> +<tt class=
756 "REPLACEABLE"><i>name</i></tt>{<tt class=
757 "REPLACEABLE"><i>param</i></tt>} # enable action and set parameter to <tt class="REPLACEABLE"><i>param</i></tt>,
758 # overwriting parameter from previous match if necessary
760 "REPLACEABLE"><i>name</i></tt> # disable action. The parameter can be omitted</pre>
764 <p>Note that if the URL matches multiple positive forms of a
765 parameterized action, the last match wins, i.e. the params from
766 earlier matches are simply ignored.</p>
767 <p>Example: <tt class="LITERAL">+hide-user-agent{Mozilla/5.0 (X11;
768 U; FreeBSD i386; en-US; rv:1.8.1.4) Gecko/20070602
769 Firefox/2.0.0.4}</tt></p>
772 <p>Multi-value. These look exactly like parameterized actions, but
773 they behave differently: If the action applies multiple times to
774 the same URL, but with different parameters, <span class=
775 "emphasis"><i class="EMPHASIS">all</i></span> the parameters from
776 <span class="emphasis"><i class="EMPHASIS">all</i></span> matches
777 are remembered. This is used for actions that can be executed for
778 the same request repeatedly, like adding multiple headers, or
779 filtering through multiple filters. Syntax:</p>
780 <table border="0" bgcolor="#E0E0E0" width="90%">
783 <pre class="SCREEN"> +<tt class=
784 "REPLACEABLE"><i>name</i></tt>{<tt class=
785 "REPLACEABLE"><i>param</i></tt>} # enable action and add <tt class=
786 "REPLACEABLE"><i>param</i></tt> to the list of parameters
787 -<tt class="REPLACEABLE"><i>name</i></tt>{<tt class=
788 "REPLACEABLE"><i>param</i></tt>} # remove the parameter <tt class=
789 "REPLACEABLE"><i>param</i></tt> from the list of parameters
790 # If it was the last one left, disable the action.
792 "REPLACEABLE"><i>-name</i></tt> # disable this action completely and remove all parameters from the list</pre>
796 <p>Examples: <tt class="LITERAL">+add-header{X-Fun-Header: Some
797 text}</tt> and <tt class=
798 "LITERAL">+filter{html-annoyances}</tt></p>
801 <p>If nothing is specified in any actions file, no <span class=
802 "QUOTE">"actions"</span> are taken. So in this case <span class=
803 "APPLICATION">Privoxy</span> would just be a normal, non-blocking,
804 non-filtering proxy. You must specifically enable the privacy and
805 blocking features you need (although the provided default actions files
806 will give a good starting point).</p>
807 <p>Later defined action sections always over-ride earlier ones of the
808 same type. So exceptions to any rules you make, should come in the
809 latter part of the file (or in a file that is processed later when
810 using multiple actions files such as <tt class=
811 "FILENAME">user.action</tt>). For multi-valued actions, the actions are
812 applied in the order they are specified. Actions files are processed in
813 the order they are defined in <tt class="FILENAME">config</tt> (the
814 default installation has three actions files). It also quite possible
815 for any given URL to match more than one <span class=
816 "QUOTE">"pattern"</span> (because of wildcards and regular
817 expressions), and thus to trigger more than one set of actions! Last
819 <p>The list of valid <span class="APPLICATION">Privoxy</span> actions
822 <h4 class="SECT3"><a name="ADD-HEADER" id="ADD-HEADER">8.5.1.
824 <div class="VARIABLELIST">
826 <dt>Typical use:</dt>
828 <p>Confuse log analysis, custom applications</p>
832 <p>Sends a user defined HTTP header to the web server.</p>
840 <p>Any string value is possible. Validity of the defined HTTP
841 headers is not checked. It is recommended that you use the
842 <span class="QUOTE">"<tt class="LITERAL">X-</tt>"</span> prefix
843 for custom headers.</p>
847 <p>This action may be specified multiple times, in order to
848 define multiple headers. This is rarely needed for the typical
849 user. If you don't know what <span class="QUOTE">"HTTP
850 headers"</span> are, you definitely don't need to worry about
852 <p>Headers added by this action are not modified by other
855 <dt>Example usage:</dt>
857 <table border="0" bgcolor="#E0E0E0" width="90%">
861 # Add a DNT ("Do not track") header to all requests,
862 # event to those that already have one.
864 # This is just an example, not a recommendation.
866 # There is no reason to believe that user-tracking websites care
867 # about the DNT header and depending on the User-Agent, adding the
868 # header may make user-tracking easier.
869 {+add-header{DNT: 1}}
879 <h4 class="SECT3"><a name="BLOCK" id="BLOCK">8.5.2. block</a></h4>
880 <div class="VARIABLELIST">
882 <dt>Typical use:</dt>
884 <p>Block ads or other unwanted content</p>
888 <p>Requests for URLs to which this action applies are blocked,
889 i.e. the requests are trapped by <span class=
890 "APPLICATION">Privoxy</span> and the requested URL is never
891 retrieved, but is answered locally with a substitute page or
892 image, as determined by the <tt class="LITERAL"><a href=
893 "actions-file.html#HANDLE-AS-IMAGE">handle-as-image</a></tt>,
894 <tt class="LITERAL"><a href=
895 "actions-file.html#SET-IMAGE-BLOCKER">set-image-blocker</a></tt>,
896 and <tt class="LITERAL"><a href=
897 "actions-file.html#HANDLE-AS-EMPTY-DOCUMENT">handle-as-empty-document</a></tt>
902 <p>Parameterized.</p>
906 <p>A block reason that should be given to the user.</p>
910 <p><span class="APPLICATION">Privoxy</span> sends a special
911 <span class="QUOTE">"BLOCKED"</span> page for requests to
912 blocked pages. This page contains the block reason given as
913 parameter, a link to find out why the block action applies, and
914 a click-through to the blocked content (the latter only if the
915 force feature is available and enabled).</p>
916 <p>A very important exception occurs if <span class=
917 "emphasis"><i class="EMPHASIS">both</i></span> <tt class=
918 "LITERAL">block</tt> and <tt class="LITERAL"><a href=
919 "actions-file.html#HANDLE-AS-IMAGE">handle-as-image</a></tt>,
920 apply to the same request: it will then be replaced by an
921 image. If <tt class="LITERAL"><a href=
922 "actions-file.html#SET-IMAGE-BLOCKER">set-image-blocker</a></tt>
923 (see below) also applies, the type of image will be determined
924 by its parameter, if not, the standard checkerboard pattern is
926 <p>It is important to understand this process, in order to
927 understand how <span class="APPLICATION">Privoxy</span> deals
928 with ads and other unwanted content. Blocking is a core
929 feature, and one upon which various other features depend.</p>
930 <p>The <tt class="LITERAL"><a href=
931 "actions-file.html#FILTER">filter</a></tt> action can perform a
932 very similar task, by <span class="QUOTE">"blocking"</span>
933 banner images and other content through rewriting the relevant
934 URLs in the document's HTML source, so they don't get requested
935 in the first place. Note that this is a totally different
936 technique, and it's easy to confuse the two.</p>
938 <dt>Example usage (section):</dt>
940 <table border="0" bgcolor="#E0E0E0" width="90%">
943 <pre class="SCREEN">{+block{No nasty stuff for you.}}
944 # Block and replace with "blocked" page
945 .nasty-stuff.example.com
947 {+block{Doubleclick banners.} +handle-as-image}
948 # Block and replace with image
952 {+block{Layered ads.} +handle-as-empty-document}
953 # Block and then ignore
954 adserver.example.net/.*\.js$</pre>
963 <h4 class="SECT3"><a name="CHANGE-X-FORWARDED-FOR" id=
964 "CHANGE-X-FORWARDED-FOR">8.5.3. change-x-forwarded-for</a></h4>
965 <div class="VARIABLELIST">
967 <dt>Typical use:</dt>
969 <p>Improve privacy by not forwarding the source of the request
970 in the HTTP headers.</p>
974 <p>Deletes the <span class="QUOTE">"X-Forwarded-For:"</span>
975 HTTP header from the client request, or adds a new one.</p>
979 <p>Parameterized.</p>
985 <p><span class="QUOTE">"block"</span> to delete the
989 <p><span class="QUOTE">"add"</span> to create the header
990 (or append the client's IP address to an already existing
997 <p>It is safe and recommended to use <tt class=
998 "LITERAL">block</tt>.</p>
999 <p>Forwarding the source address of the request may make sense
1000 in some multi-user setups but is also a privacy risk.</p>
1002 <dt>Example usage:</dt>
1004 <table border="0" bgcolor="#E0E0E0" width="90%">
1007 <pre class="SCREEN">+change-x-forwarded-for{block}</pre>
1016 <h4 class="SECT3"><a name="CLIENT-HEADER-FILTER" id=
1017 "CLIENT-HEADER-FILTER">8.5.4. client-header-filter</a></h4>
1018 <div class="VARIABLELIST">
1020 <dt>Typical use:</dt>
1022 <p>Rewrite or remove single client headers.</p>
1026 <p>All client headers to which this action applies are filtered
1027 on-the-fly through the specified regular expression based
1036 <p>The name of a client-header filter, as defined in one of the
1037 <a href="filter-file.html">filter files</a>.</p>
1041 <p>Client-header filters are applied to each header on its own,
1042 not to all at once. This makes it easier to diagnose problems,
1043 but on the downside you can't write filters that only change
1044 header x if header y's value is z. You can do that by using
1046 <p>Client-header filters are executed after the other header
1047 actions have finished and use their output as input.</p>
1048 <p>If the request URI gets changed, <span class=
1049 "APPLICATION">Privoxy</span> will detect that and use the new
1050 one. This can be used to rewrite the request destination behind
1051 the client's back, for example to specify a Tor exit relay for
1052 certain requests.</p>
1053 <p>Please refer to the <a href="filter-file.html">filter file
1054 chapter</a> to learn which client-header filters are available
1055 by default, and how to create your own.</p>
1057 <dt>Example usage (section):</dt>
1059 <table border="0" bgcolor="#E0E0E0" width="90%">
1062 <pre class="SCREEN">
1063 # Hide Tor exit notation in Host and Referer Headers
1064 {+client-header-filter{hide-tor-exit-notation}}
1075 <h4 class="SECT3"><a name="CLIENT-HEADER-TAGGER" id=
1076 "CLIENT-HEADER-TAGGER">8.5.5. client-header-tagger</a></h4>
1077 <div class="VARIABLELIST">
1079 <dt>Typical use:</dt>
1081 <p>Block requests based on their headers.</p>
1085 <p>Client headers to which this action applies are filtered
1086 on-the-fly through the specified regular expression based
1087 substitutions, the result is used as tag.</p>
1095 <p>The name of a client-header tagger, as defined in one of the
1096 <a href="filter-file.html">filter files</a>.</p>
1100 <p>Client-header taggers are applied to each header on its own,
1101 and as the header isn't modified, each tagger <span class=
1102 "QUOTE">"sees"</span> the original.</p>
1103 <p>Client-header taggers are the first actions that are
1104 executed and their tags can be used to control every other
1107 <dt>Example usage (section):</dt>
1109 <table border="0" bgcolor="#E0E0E0" width="90%">
1112 <pre class="SCREEN">
1113 # Tag every request with the User-Agent header
1114 {+client-header-tagger{user-agent}}
1117 # Tagging itself doesn't change the action
1118 # settings, sections with TAG patterns do:
1120 # If it's a download agent, use a different forwarding proxy,
1121 # show the real User-Agent and make sure resume works.
1122 {+forward-override{forward-socks5 10.0.0.2:2222 .} \
1123 -hide-if-modified-since \
1124 -overwrite-last-modified \
1129 TAG:^User-Agent: NetBSD-ftp/
1130 TAG:^User-Agent: Novell ZYPP Installer
1131 TAG:^User-Agent: RPM APT-HTTP/
1132 TAG:^User-Agent: fetch libfetch/
1133 TAG:^User-Agent: Ubuntu APT-HTTP/
1134 TAG:^User-Agent: MPlayer/
1139 <table border="0" bgcolor="#E0E0E0" width="90%">
1142 <pre class="SCREEN">
1143 # Tag all requests with the Range header set
1144 {+client-header-tagger{range-requests}}
1147 # Disable filtering for the tagged requests.
1149 # With filtering enabled Privoxy would remove the Range headers
1150 # to be able to filter the whole response. The downside is that
1151 # it prevents clients from resuming downloads or skipping over
1152 # parts of multimedia files.
1153 {-filter -deanimate-gifs}
1164 <h4 class="SECT3"><a name="CONTENT-TYPE-OVERWRITE" id=
1165 "CONTENT-TYPE-OVERWRITE">8.5.6. content-type-overwrite</a></h4>
1166 <div class="VARIABLELIST">
1168 <dt>Typical use:</dt>
1170 <p>Stop useless download menus from popping up, or change the
1171 browser's rendering mode</p>
1175 <p>Replaces the <span class="QUOTE">"Content-Type:"</span> HTTP
1180 <p>Parameterized.</p>
1188 <p>The <span class="QUOTE">"Content-Type:"</span> HTTP server
1189 header is used by the browser to decide what to do with the
1190 document. The value of this header can cause the browser to
1191 open a download menu instead of displaying the document by
1192 itself, even if the document's format is supported by the
1194 <p>The declared content type can also affect which rendering
1195 mode the browser chooses. If XHTML is delivered as <span class=
1196 "QUOTE">"text/html"</span>, many browsers treat it as yet
1197 another broken HTML document. If it is send as <span class=
1198 "QUOTE">"application/xml"</span>, browsers with XHTML support
1199 will only display it, if the syntax is correct.</p>
1200 <p>If you see a web site that proudly uses XHTML buttons, but
1201 sets <span class="QUOTE">"Content-Type: text/html"</span>, you
1202 can use <span class="APPLICATION">Privoxy</span> to overwrite
1203 it with <span class="QUOTE">"application/xml"</span> and
1204 validate the web master's claim inside your XHTML-supporting
1205 browser. If the syntax is incorrect, the browser will complain
1207 <p>You can also go the opposite direction: if your browser
1208 prints error messages instead of rendering a document falsely
1209 declared as XHTML, you can overwrite the content type with
1210 <span class="QUOTE">"text/html"</span> and have it rendered as
1211 broken HTML document.</p>
1212 <p>By default <tt class="LITERAL">content-type-overwrite</tt>
1213 only replaces <span class="QUOTE">"Content-Type:"</span>
1214 headers that look like some kind of text. If you want to
1215 overwrite it unconditionally, you have to combine it with
1216 <tt class="LITERAL"><a href=
1217 "actions-file.html#FORCE-TEXT-MODE">force-text-mode</a></tt>.
1218 This limitation exists for a reason, think twice before
1219 circumventing it.</p>
1220 <p>Most of the time it's easier to replace this action with a
1221 custom <tt class="LITERAL"><a href=
1222 "actions-file.html#SERVER-HEADER-FILTER">server-header
1223 filter</a></tt>. It allows you to activate it for every
1224 document of a certain site and it will still only replace the
1225 content types you aimed at.</p>
1226 <p>Of course you can apply <tt class=
1227 "LITERAL">content-type-overwrite</tt> to a whole site and then
1228 make URL based exceptions, but it's a lot more work to get the
1231 <dt>Example usage (sections):</dt>
1233 <table border="0" bgcolor="#E0E0E0" width="90%">
1236 <pre class="SCREEN">
1237 # Check if www.example.net/ really uses valid XHTML
1238 { +content-type-overwrite{application/xml} }
1241 # but leave the content type unmodified if the URL looks like a style sheet
1242 {-content-type-overwrite}
1243 www.example.net/.*\.css$
1244 www.example.net/.*style</pre>
1253 <h4 class="SECT3"><a name="CRUNCH-CLIENT-HEADER" id=
1254 "CRUNCH-CLIENT-HEADER">8.5.7. crunch-client-header</a></h4>
1255 <div class="VARIABLELIST">
1257 <dt>Typical use:</dt>
1259 <p>Remove a client header <span class=
1260 "APPLICATION">Privoxy</span> has no dedicated action for.</p>
1264 <p>Deletes every header sent by the client that contains the
1265 string the user supplied as parameter.</p>
1269 <p>Parameterized.</p>
1277 <p>This action allows you to block client headers for which no
1278 dedicated <span class="APPLICATION">Privoxy</span> action
1279 exists. <span class="APPLICATION">Privoxy</span> will remove
1280 every client header that contains the string you supplied as
1282 <p>Regular expressions are <span class="emphasis"><i class=
1283 "EMPHASIS">not supported</i></span> and you can't use this
1284 action to block different headers in the same request, unless
1285 they contain the same string.</p>
1286 <p><tt class="LITERAL">crunch-client-header</tt> is only meant
1287 for quick tests. If you have to block several different
1288 headers, or only want to modify parts of them, you should use a
1289 <tt class="LITERAL"><a href=
1290 "actions-file.html#CLIENT-HEADER-FILTER">client-header
1291 filter</a></tt>.</p>
1292 <div class="WARNING">
1293 <table class="WARNING" border="1" width="90%">
1295 <td align="center"><b>Warning</b></td>
1299 <p>Don't block any header without understanding the
1306 <dt>Example usage (section):</dt>
1308 <table border="0" bgcolor="#E0E0E0" width="90%">
1311 <pre class="SCREEN">
1312 # Block the non-existent "Privacy-Violation:" client header
1313 { +crunch-client-header{Privacy-Violation:} }
1324 <h4 class="SECT3"><a name="CRUNCH-IF-NONE-MATCH" id=
1325 "CRUNCH-IF-NONE-MATCH">8.5.8. crunch-if-none-match</a></h4>
1326 <div class="VARIABLELIST">
1328 <dt>Typical use:</dt>
1330 <p>Prevent yet another way to track the user's steps between
1335 <p>Deletes the <span class="QUOTE">"If-None-Match:"</span> HTTP
1348 <p>Removing the <span class="QUOTE">"If-None-Match:"</span>
1349 HTTP client header is useful for filter testing, where you want
1350 to force a real reload instead of getting status code
1351 <span class="QUOTE">"304"</span> which would cause the browser
1352 to use a cached copy of the page.</p>
1353 <p>It is also useful to make sure the header isn't used as a
1354 cookie replacement (unlikely but possible).</p>
1355 <p>Blocking the <span class="QUOTE">"If-None-Match:"</span>
1356 header shouldn't cause any caching problems, as long as the
1357 <span class="QUOTE">"If-Modified-Since:"</span> header isn't
1358 blocked or missing as well.</p>
1359 <p>It is recommended to use this action together with
1360 <tt class="LITERAL"><a href=
1361 "actions-file.html#HIDE-IF-MODIFIED-SINCE">hide-if-modified-since</a></tt>
1362 and <tt class="LITERAL"><a href=
1363 "actions-file.html#OVERWRITE-LAST-MODIFIED">overwrite-last-modified</a></tt>.</p>
1365 <dt>Example usage (section):</dt>
1367 <table border="0" bgcolor="#E0E0E0" width="90%">
1370 <pre class="SCREEN">
1371 # Let the browser revalidate cached documents but don't
1372 # allow the server to use the revalidation headers for user tracking.
1373 {+hide-if-modified-since{-60} \
1374 +overwrite-last-modified{randomize} \
1375 +crunch-if-none-match}
1385 <h4 class="SECT3"><a name="CRUNCH-INCOMING-COOKIES" id=
1386 "CRUNCH-INCOMING-COOKIES">8.5.9. crunch-incoming-cookies</a></h4>
1387 <div class="VARIABLELIST">
1389 <dt>Typical use:</dt>
1391 <p>Prevent the web server from setting HTTP cookies on your
1396 <p>Deletes any <span class="QUOTE">"Set-Cookie:"</span> HTTP
1397 headers from server replies.</p>
1409 <p>This action is only concerned with <span class=
1410 "emphasis"><i class="EMPHASIS">incoming</i></span> HTTP
1411 cookies. For <span class="emphasis"><i class=
1412 "EMPHASIS">outgoing</i></span> HTTP cookies, use <tt class=
1414 "actions-file.html#CRUNCH-OUTGOING-COOKIES">crunch-outgoing-cookies</a></tt>.
1415 Use <span class="emphasis"><i class="EMPHASIS">both</i></span>
1416 to disable HTTP cookies completely.</p>
1417 <p>It makes <span class="emphasis"><i class="EMPHASIS">no sense
1418 at all</i></span> to use this action in conjunction with the
1419 <tt class="LITERAL"><a href=
1420 "actions-file.html#SESSION-COOKIES-ONLY">session-cookies-only</a></tt>
1421 action, since it would prevent the session cookies from being
1422 set. See also <tt class="LITERAL"><a href=
1423 "actions-file.html#FILTER-CONTENT-COOKIES">filter-content-cookies</a></tt>.</p>
1425 <dt>Example usage:</dt>
1427 <table border="0" bgcolor="#E0E0E0" width="90%">
1430 <pre class="SCREEN">+crunch-incoming-cookies</pre>
1439 <h4 class="SECT3"><a name="CRUNCH-SERVER-HEADER" id=
1440 "CRUNCH-SERVER-HEADER">8.5.10. crunch-server-header</a></h4>
1441 <div class="VARIABLELIST">
1443 <dt>Typical use:</dt>
1445 <p>Remove a server header <span class=
1446 "APPLICATION">Privoxy</span> has no dedicated action for.</p>
1450 <p>Deletes every header sent by the server that contains the
1451 string the user supplied as parameter.</p>
1455 <p>Parameterized.</p>
1463 <p>This action allows you to block server headers for which no
1464 dedicated <span class="APPLICATION">Privoxy</span> action
1465 exists. <span class="APPLICATION">Privoxy</span> will remove
1466 every server header that contains the string you supplied as
1468 <p>Regular expressions are <span class="emphasis"><i class=
1469 "EMPHASIS">not supported</i></span> and you can't use this
1470 action to block different headers in the same request, unless
1471 they contain the same string.</p>
1472 <p><tt class="LITERAL">crunch-server-header</tt> is only meant
1473 for quick tests. If you have to block several different
1474 headers, or only want to modify parts of them, you should use a
1475 custom <tt class="LITERAL"><a href=
1476 "actions-file.html#SERVER-HEADER-FILTER">server-header
1477 filter</a></tt>.</p>
1478 <div class="WARNING">
1479 <table class="WARNING" border="1" width="90%">
1481 <td align="center"><b>Warning</b></td>
1485 <p>Don't block any header without understanding the
1492 <dt>Example usage (section):</dt>
1494 <table border="0" bgcolor="#E0E0E0" width="90%">
1497 <pre class="SCREEN">
1498 # Crunch server headers that try to prevent caching
1499 { +crunch-server-header{no-cache} }
1509 <h4 class="SECT3"><a name="CRUNCH-OUTGOING-COOKIES" id=
1510 "CRUNCH-OUTGOING-COOKIES">8.5.11. crunch-outgoing-cookies</a></h4>
1511 <div class="VARIABLELIST">
1513 <dt>Typical use:</dt>
1515 <p>Prevent the web server from reading any HTTP cookies from
1520 <p>Deletes any <span class="QUOTE">"Cookie:"</span> HTTP
1521 headers from client requests.</p>
1533 <p>This action is only concerned with <span class=
1534 "emphasis"><i class="EMPHASIS">outgoing</i></span> HTTP
1535 cookies. For <span class="emphasis"><i class=
1536 "EMPHASIS">incoming</i></span> HTTP cookies, use <tt class=
1538 "actions-file.html#CRUNCH-INCOMING-COOKIES">crunch-incoming-cookies</a></tt>.
1539 Use <span class="emphasis"><i class="EMPHASIS">both</i></span>
1540 to disable HTTP cookies completely.</p>
1541 <p>It makes <span class="emphasis"><i class="EMPHASIS">no sense
1542 at all</i></span> to use this action in conjunction with the
1543 <tt class="LITERAL"><a href=
1544 "actions-file.html#SESSION-COOKIES-ONLY">session-cookies-only</a></tt>
1545 action, since it would prevent the session cookies from being
1548 <dt>Example usage:</dt>
1550 <table border="0" bgcolor="#E0E0E0" width="90%">
1553 <pre class="SCREEN">+crunch-outgoing-cookies</pre>
1562 <h4 class="SECT3"><a name="DEANIMATE-GIFS" id=
1563 "DEANIMATE-GIFS">8.5.12. deanimate-gifs</a></h4>
1564 <div class="VARIABLELIST">
1566 <dt>Typical use:</dt>
1568 <p>Stop those annoying, distracting animated GIF images.</p>
1572 <p>De-animate GIF animations, i.e. reduce them to their first
1577 <p>Parameterized.</p>
1581 <p><span class="QUOTE">"last"</span> or <span class=
1582 "QUOTE">"first"</span></p>
1586 <p>This will also shrink the images considerably (in bytes, not
1587 pixels!). If the option <span class="QUOTE">"first"</span> is
1588 given, the first frame of the animation is used as the
1589 replacement. If <span class="QUOTE">"last"</span> is given, the
1590 last frame of the animation is used instead, which probably
1591 makes more sense for most banner animations, but also has the
1592 risk of not showing the entire last frame (if it is only a
1593 delta to an earlier frame).</p>
1594 <p>You can safely use this action with patterns that will also
1595 match non-GIF objects, because no attempt will be made at
1596 anything that doesn't look like a GIF.</p>
1598 <dt>Example usage:</dt>
1600 <table border="0" bgcolor="#E0E0E0" width="90%">
1603 <pre class="SCREEN">+deanimate-gifs{last}</pre>
1612 <h4 class="SECT3"><a name="DOWNGRADE-HTTP-VERSION" id=
1613 "DOWNGRADE-HTTP-VERSION">8.5.13. downgrade-http-version</a></h4>
1614 <div class="VARIABLELIST">
1616 <dt>Typical use:</dt>
1618 <p>Work around (very rare) problems with HTTP/1.1</p>
1622 <p>Downgrades HTTP/1.1 client requests and server replies to
1635 <p>This is a left-over from the time when <span class=
1636 "APPLICATION">Privoxy</span> didn't support important HTTP/1.1
1637 features well. It is left here for the unlikely case that you
1638 experience HTTP/1.1-related problems with some server out
1640 <p>Note that enabling this action is only a workaround. It
1641 should not be enabled for sites that work without it. While it
1642 shouldn't break any pages, it has an (usually negative)
1643 performance impact.</p>
1644 <p>If you come across a site where enabling this action helps,
1645 please report it, so the cause of the problem can be analyzed.
1646 If the problem turns out to be caused by a bug in <span class=
1647 "APPLICATION">Privoxy</span> it should be fixed so the
1648 following release works without the work around.</p>
1650 <dt>Example usage (section):</dt>
1652 <table border="0" bgcolor="#E0E0E0" width="90%">
1655 <pre class="SCREEN">{+downgrade-http-version}
1656 problem-host.example.com</pre>
1665 <h4 class="SECT3"><a name="EXTERNAL-FILTER" id=
1666 "EXTERNAL-FILTER">8.5.14. external-filter</a></h4>
1667 <div class="VARIABLELIST">
1669 <dt>Typical use:</dt>
1671 <p>Modify content using a programming language of your
1676 <p>All instances of text-based type, most notably HTML and
1677 JavaScript, to which this action applies, can be filtered
1678 on-the-fly through the specified external filter. By default
1679 plain text documents are exempted from filtering, because web
1680 servers often use the <tt class="LITERAL">text/plain</tt> MIME
1681 type for all files whose type they don't know.)</p>
1689 <p>The name of an external content filter, as defined in the
1690 <a href="filter-file.html">filter file</a>. External filters
1691 can be defined in one or more files as defined by the
1692 <tt class="LITERAL"><a href=
1693 "config.html#FILTERFILE">filterfile</a></tt> option in the
1694 <a href="config.html">config file</a>.</p>
1695 <p>When used in its negative form, and without parameters,
1696 <span class="emphasis"><i class="EMPHASIS">all</i></span>
1697 filtering with external filters is completely disabled.</p>
1701 <p>External filters are scripts or programs that can modify the
1702 content in case common <tt class="LITERAL"><a href=
1703 "actions-file.html#FILTER">filters</a></tt> aren't powerful
1704 enough. With the exception that this action doesn't use
1705 pcrs-based filters, the notes in the <tt class=
1706 "LITERAL"><a href="actions-file.html#FILTER">filter</a></tt>
1708 <div class="WARNING">
1709 <table class="WARNING" border="1" width="90%">
1711 <td align="center"><b>Warning</b></td>
1715 <p>Currently external filters are executed with
1716 <span class="APPLICATION">Privoxy</span>'s privileges.
1717 Only use external filters you understand and trust.</p>
1722 <p>This feature is experimental, the <tt class=
1724 "filter-file.html#EXTERNAL-FILTER-SYNTAX">syntax</a></tt> may
1725 change in the future.</p>
1727 <dt>Example usage:</dt>
1729 <table border="0" bgcolor="#E0E0E0" width="90%">
1732 <pre class="SCREEN">+external-filter{fancy-filter}</pre>
1741 <h4 class="SECT3"><a name="FAST-REDIRECTS" id=
1742 "FAST-REDIRECTS">8.5.15. fast-redirects</a></h4>
1743 <div class="VARIABLELIST">
1745 <dt>Typical use:</dt>
1747 <p>Fool some click-tracking scripts and speed up indirect
1752 <p>Detects redirection URLs and redirects the browser without
1753 contacting the redirection server first.</p>
1757 <p>Parameterized.</p>
1763 <p><span class="QUOTE">"simple-check"</span> to just search
1764 for the string <span class="QUOTE">"http://"</span> to
1765 detect redirection URLs.</p>
1768 <p><span class="QUOTE">"check-decoded-url"</span> to decode
1769 URLs (if necessary) before searching for redirection
1776 <p>Many sites, like yahoo.com, don't just link to other sites.
1777 Instead, they will link to some script on their own servers,
1778 giving the destination as a parameter, which will then redirect
1779 you to the final target. URLs resulting from this scheme
1780 typically look like: <span class=
1781 "QUOTE">"http://www.example.org/click-tracker.cgi?target=http%3a//www.example.net/"</span>.</p>
1782 <p>Sometimes, there are even multiple consecutive redirects
1783 encoded in the URL. These redirections via scripts make your
1784 web browsing more traceable, since the server from which you
1785 follow such a link can see where you go to. Apart from that,
1786 valuable bandwidth and time is wasted, while your browser asks
1787 the server for one redirect after the other. Plus, it feeds the
1789 <p>This feature is currently not very smart and is scheduled
1790 for improvement. If it is enabled by default, you will have to
1791 create some exceptions to this action. It can lead to failures
1792 in several ways:</p>
1793 <p>Not every URLs with other URLs as parameters is evil. Some
1794 sites offer a real service that requires this information to
1795 work. For example a validation service needs to know, which
1796 document to validate. <tt class="LITERAL">fast-redirects</tt>
1797 assumes that every URL parameter that looks like another URL is
1798 a redirection target, and will always redirect to the last one.
1799 Most of the time the assumption is correct, but if it isn't,
1800 the user gets redirected anyway.</p>
1801 <p>Another failure occurs if the URL contains other parameters
1802 after the URL parameter. The URL: <span class=
1803 "QUOTE">"http://www.example.org/?redirect=http%3a//www.example.net/&foo=bar"</span>.
1804 contains the redirection URL <span class=
1805 "QUOTE">"http://www.example.net/"</span>, followed by another
1806 parameter. <tt class="LITERAL">fast-redirects</tt> doesn't know
1807 that and will cause a redirect to <span class=
1808 "QUOTE">"http://www.example.net/&foo=bar"</span>. Depending
1809 on the target server configuration, the parameter will be
1810 silently ignored or lead to a <span class="QUOTE">"page not
1811 found"</span> error. You can prevent this problem by first
1812 using the <tt class="LITERAL"><a href=
1813 "actions-file.html#REDIRECT">redirect</a></tt> action to remove
1814 the last part of the URL, but it requires a little effort.</p>
1815 <p>To detect a redirection URL, <tt class=
1816 "LITERAL">fast-redirects</tt> only looks for the string
1817 <span class="QUOTE">"http://"</span>, either in plain text
1818 (invalid but often used) or encoded as <span class=
1819 "QUOTE">"http%3a//"</span>. Some sites use their own URL
1820 encoding scheme, encrypt the address of the target server or
1821 replace it with a database id. In theses cases <tt class=
1822 "LITERAL">fast-redirects</tt> is fooled and the request reaches
1823 the redirection server where it probably gets logged.</p>
1825 <dt>Example usage:</dt>
1827 <table border="0" bgcolor="#E0E0E0" width="90%">
1830 <pre class="SCREEN"> { +fast-redirects{simple-check} }
1833 { +fast-redirects{check-decoded-url} }
1834 another.example.com/testing</pre>
1843 <h4 class="SECT3"><a name="FILTER" id="FILTER">8.5.16.
1845 <div class="VARIABLELIST">
1847 <dt>Typical use:</dt>
1849 <p>Get rid of HTML and JavaScript annoyances, banner
1850 advertisements (by size), do fun text replacements, add
1851 personalized effects, etc.</p>
1855 <p>All instances of text-based type, most notably HTML and
1856 JavaScript, to which this action applies, can be filtered
1857 on-the-fly through the specified regular expression based
1858 substitutions. (Note: as of version 3.0.3 plain text documents
1859 are exempted from filtering, because web servers often use the
1860 <tt class="LITERAL">text/plain</tt> MIME type for all files
1861 whose type they don't know.)</p>
1869 <p>The name of a content filter, as defined in the <a href=
1870 "filter-file.html">filter file</a>. Filters can be defined in
1871 one or more files as defined by the <tt class=
1872 "LITERAL"><a href="config.html#FILTERFILE">filterfile</a></tt>
1873 option in the <a href="config.html">config file</a>. <tt class=
1874 "FILENAME">default.filter</tt> is the collection of filters
1875 supplied by the developers. Locally defined filters should go
1876 in their own file, such as <tt class=
1877 "FILENAME">user.filter</tt>.</p>
1878 <p>When used in its negative form, and without parameters,
1879 <span class="emphasis"><i class="EMPHASIS">all</i></span>
1880 filtering is completely disabled.</p>
1884 <p>For your convenience, there are a number of pre-defined
1885 filters available in the distribution filter file that you can
1886 use. See the examples below for a list.</p>
1887 <p>Filtering requires buffering the page content, which may
1888 appear to slow down page rendering since nothing is displayed
1889 until all content has passed the filters. (The total time until
1890 the page is completely rendered doesn't change much, but it may
1891 be perceived as slower since the page is not incrementally
1892 displayed.) This effect will be more noticeable on slower
1894 <p><span class="QUOTE">"Rolling your own"</span> filters
1895 requires a knowledge of <a href=
1896 "http://en.wikipedia.org/wiki/Regular_expressions" target=
1897 "_top"><span class="QUOTE">"Regular Expressions"</span></a> and
1898 <a href="http://en.wikipedia.org/wiki/Html" target=
1899 "_top"><span class="QUOTE">"HTML"</span></a>. This is very
1900 powerful feature, and potentially very intrusive. Filters
1901 should be used with caution, and where an equivalent
1902 <span class="QUOTE">"action"</span> is not available.</p>
1903 <p>The amount of data that can be filtered is limited to the
1904 <tt class="LITERAL"><a href=
1905 "config.html#BUFFER-LIMIT">buffer-limit</a></tt> option in the
1906 main <a href="config.html">config file</a>. The default is 4096
1907 KB (4 Megs). Once this limit is exceeded, the buffered data,
1908 and all pending data, is passed through unfiltered.</p>
1909 <p>Inappropriate MIME types, such as zipped files, are not
1910 filtered at all. (Again, only text-based types except plain
1911 text). Encrypted SSL data (from HTTPS servers) cannot be
1912 filtered either, since this would violate the integrity of the
1913 secure transaction. In some situations it might be necessary to
1914 protect certain text, like source code, from filtering by
1915 defining appropriate <tt class="LITERAL">-filter</tt>
1917 <p>Compressed content can't be filtered either, but if
1918 <span class="APPLICATION">Privoxy</span> is compiled with zlib
1919 support and a supported compression algorithm is used (gzip or
1920 deflate), <span class="APPLICATION">Privoxy</span> can first
1921 decompress the content and then filter it.</p>
1922 <p>If you use a <span class="APPLICATION">Privoxy</span>
1923 version without zlib support, but want filtering to work on as
1924 much documents as possible, even those that would normally be
1925 sent compressed, you must use the <tt class="LITERAL"><a href=
1926 "actions-file.html#PREVENT-COMPRESSION">prevent-compression</a></tt>
1927 action in conjunction with <tt class="LITERAL">filter</tt>.</p>
1928 <p>Content filtering can achieve some of the same effects as
1929 the <tt class="LITERAL"><a href=
1930 "actions-file.html#BLOCK">block</a></tt> action, i.e. it can be
1931 used to block ads and banners. But the mechanism works quite
1932 differently. One effective use, is to block ad banners based on
1933 their size (see below), since many of these seem to be somewhat
1935 <p><a href="contact.html">Feedback</a> with suggestions for new
1936 or improved filters is particularly welcome!</p>
1937 <p>The below list has only the names and a one-line description
1938 of each predefined filter. There are <a href=
1939 "filter-file.html#PREDEFINED-FILTERS">more verbose
1940 explanations</a> of what these filters do in the <a href=
1941 "filter-file.html">filter file chapter</a>.</p>
1943 <dt>Example usage (with filters from the distribution <tt class=
1944 "FILENAME">default.filter</tt> file). See <a href=
1945 "filter-file.html#PREDEFINED-FILTERS">the Predefined Filters
1946 section</a> for more explanation on each:</dt>
1948 <p><a name="FILTER-JS-ANNOYANCES" id=
1949 "FILTER-JS-ANNOYANCES"></a></p>
1950 <table border="0" bgcolor="#E0E0E0" width="90%">
1953 <pre class="SCREEN">
1954 +filter{js-annoyances} # Get rid of particularly annoying JavaScript abuse.</pre>
1958 <p><a name="FILTER-JS-EVENTS" id="FILTER-JS-EVENTS"></a></p>
1959 <table border="0" bgcolor="#E0E0E0" width="90%">
1962 <pre class="SCREEN">
1963 +filter{js-events} # Kill JavaScript event bindings and timers (Radically destructive! Only for extra nasty sites).</pre>
1967 <p><a name="FILTER-HTML-ANNOYANCES" id=
1968 "FILTER-HTML-ANNOYANCES"></a></p>
1969 <table border="0" bgcolor="#E0E0E0" width="90%">
1972 <pre class="SCREEN">
1973 +filter{html-annoyances} # Get rid of particularly annoying HTML abuse.</pre>
1977 <p><a name="FILTER-CONTENT-COOKIES" id=
1978 "FILTER-CONTENT-COOKIES"></a></p>
1979 <table border="0" bgcolor="#E0E0E0" width="90%">
1982 <pre class="SCREEN">
1983 +filter{content-cookies} # Kill cookies that come in the HTML or JS content.</pre>
1987 <p><a name="FILTER-REFRESH-TAGS" id=
1988 "FILTER-REFRESH-TAGS"></a></p>
1989 <table border="0" bgcolor="#E0E0E0" width="90%">
1992 <pre class="SCREEN">
1993 +filter{refresh-tags} # Kill automatic refresh tags if refresh time is larger than 9 seconds.</pre>
1997 <p><a name="FILTER-UNSOLICITED-POPUPS" id=
1998 "FILTER-UNSOLICITED-POPUPS"></a></p>
1999 <table border="0" bgcolor="#E0E0E0" width="90%">
2002 <pre class="SCREEN">
2003 +filter{unsolicited-popups} # Disable only unsolicited pop-up windows.</pre>
2007 <p><a name="FILTER-ALL-POPUPS" id="FILTER-ALL-POPUPS"></a></p>
2008 <table border="0" bgcolor="#E0E0E0" width="90%">
2011 <pre class="SCREEN">
2012 +filter{all-popups} # Kill all popups in JavaScript and HTML.</pre>
2016 <p><a name="FILTER-IMG-REORDER" id=
2017 "FILTER-IMG-REORDER"></a></p>
2018 <table border="0" bgcolor="#E0E0E0" width="90%">
2021 <pre class="SCREEN">
2022 +filter{img-reorder} # Reorder attributes in <img> tags to make the banners-by-* filters more effective.</pre>
2026 <p><a name="FILTER-BANNERS-BY-SIZE" id=
2027 "FILTER-BANNERS-BY-SIZE"></a></p>
2028 <table border="0" bgcolor="#E0E0E0" width="90%">
2031 <pre class="SCREEN">
2032 +filter{banners-by-size} # Kill banners by size.</pre>
2036 <p><a name="FILTER-BANNERS-BY-LINK" id=
2037 "FILTER-BANNERS-BY-LINK"></a></p>
2038 <table border="0" bgcolor="#E0E0E0" width="90%">
2041 <pre class="SCREEN">
2042 +filter{banners-by-link} # Kill banners by their links to known clicktrackers.</pre>
2046 <p><a name="FILTER-WEBBUGS" id="FILTER-WEBBUGS"></a></p>
2047 <table border="0" bgcolor="#E0E0E0" width="90%">
2050 <pre class="SCREEN">
2051 +filter{webbugs} # Squish WebBugs (1x1 invisible GIFs used for user tracking).</pre>
2055 <p><a name="FILTER-TINY-TEXTFORMS" id=
2056 "FILTER-TINY-TEXTFORMS"></a></p>
2057 <table border="0" bgcolor="#E0E0E0" width="90%">
2060 <pre class="SCREEN">
2061 +filter{tiny-textforms} # Extend those tiny textareas up to 40x80 and kill the hard wrap.</pre>
2065 <p><a name="FILTER-JUMPING-WINDOWS" id=
2066 "FILTER-JUMPING-WINDOWS"></a></p>
2067 <table border="0" bgcolor="#E0E0E0" width="90%">
2070 <pre class="SCREEN">
2071 +filter{jumping-windows} # Prevent windows from resizing and moving themselves.</pre>
2075 <p><a name="FILTER-FRAMESET-BORDERS" id=
2076 "FILTER-FRAMESET-BORDERS"></a></p>
2077 <table border="0" bgcolor="#E0E0E0" width="90%">
2080 <pre class="SCREEN">
2081 +filter{frameset-borders} # Give frames a border and make them resizable.</pre>
2085 <p><a name="FILTER-IFRAMES" id="FILTER-IFRAMES"></a></p>
2086 <table border="0" bgcolor="#E0E0E0" width="90%">
2089 <pre class="SCREEN">
2090 +filter{iframes} # Removes all detected iframes. Should only be enabled for individual sites.</pre>
2094 <p><a name="FILTER-DEMORONIZER" id=
2095 "FILTER-DEMORONIZER"></a></p>
2096 <table border="0" bgcolor="#E0E0E0" width="90%">
2099 <pre class="SCREEN">
2100 +filter{demoronizer} # Fix MS's non-standard use of standard charsets.</pre>
2104 <p><a name="FILTER-SHOCKWAVE-FLASH" id=
2105 "FILTER-SHOCKWAVE-FLASH"></a></p>
2106 <table border="0" bgcolor="#E0E0E0" width="90%">
2109 <pre class="SCREEN">
2110 +filter{shockwave-flash} # Kill embedded Shockwave Flash objects.</pre>
2114 <p><a name="FILTER-QUICKTIME-KIOSKMODE" id=
2115 "FILTER-QUICKTIME-KIOSKMODE"></a></p>
2116 <table border="0" bgcolor="#E0E0E0" width="90%">
2119 <pre class="SCREEN">
2120 +filter{quicktime-kioskmode} # Make Quicktime movies saveable.</pre>
2124 <p><a name="FILTER-FUN" id="FILTER-FUN"></a></p>
2125 <table border="0" bgcolor="#E0E0E0" width="90%">
2128 <pre class="SCREEN">
2129 +filter{fun} # Text replacements for subversive browsing fun!</pre>
2133 <p><a name="FILTER-CRUDE-PARENTAL" id=
2134 "FILTER-CRUDE-PARENTAL"></a></p>
2135 <table border="0" bgcolor="#E0E0E0" width="90%">
2138 <pre class="SCREEN">
2139 +filter{crude-parental} # Crude parental filtering. Note that this filter doesn't work reliably.</pre>
2143 <p><a name="FILTER-IE-EXPLOITS" id=
2144 "FILTER-IE-EXPLOITS"></a></p>
2145 <table border="0" bgcolor="#E0E0E0" width="90%">
2148 <pre class="SCREEN">
2149 +filter{ie-exploits} # Disable some known Internet Explorer bug exploits.</pre>
2153 <p><a name="FILTER-SITE-SPECIFICS" id=
2154 "FILTER-SITE-SPECIFICS"></a></p>
2155 <table border="0" bgcolor="#E0E0E0" width="90%">
2158 <pre class="SCREEN">
2159 +filter{site-specifics} # Cure for site-specific problems. Don't apply generally!</pre>
2163 <p><a name="FILTER-NO-PING" id="FILTER-NO-PING"></a></p>
2164 <table border="0" bgcolor="#E0E0E0" width="90%">
2167 <pre class="SCREEN">
2168 +filter{no-ping} # Removes non-standard ping attributes in <a> and <area> tags.</pre>
2172 <p><a name="FILTER-GOOGLE" id="FILTER-GOOGLE"></a></p>
2173 <table border="0" bgcolor="#E0E0E0" width="90%">
2176 <pre class="SCREEN">
2177 +filter{google} # CSS-based block for Google text ads. Also removes a width limitation and the toolbar advertisement.</pre>
2181 <p><a name="FILTER-YAHOO" id="FILTER-YAHOO"></a></p>
2182 <table border="0" bgcolor="#E0E0E0" width="90%">
2185 <pre class="SCREEN">
2186 +filter{yahoo} # CSS-based block for Yahoo text ads. Also removes a width limitation.</pre>
2190 <p><a name="FILTER-MSN" id="FILTER-MSN"></a></p>
2191 <table border="0" bgcolor="#E0E0E0" width="90%">
2194 <pre class="SCREEN">
2195 +filter{msn} # CSS-based block for MSN text ads. Also removes tracking URLs and a width limitation.</pre>
2199 <p><a name="FILTER-BLOGSPOT" id="FILTER-BLOGSPOT"></a></p>
2200 <table border="0" bgcolor="#E0E0E0" width="90%">
2203 <pre class="SCREEN">
2204 +filter{blogspot} # Cleans up some Blogspot blogs. Read the fine print before using this.</pre>
2213 <h4 class="SECT3"><a name="FORCE-TEXT-MODE" id=
2214 "FORCE-TEXT-MODE">8.5.17. force-text-mode</a></h4>
2215 <div class="VARIABLELIST">
2217 <dt>Typical use:</dt>
2219 <p>Force <span class="APPLICATION">Privoxy</span> to treat a
2220 document as if it was in some kind of <span class=
2221 "emphasis"><i class="EMPHASIS">text</i></span> format.</p>
2225 <p>Declares a document as text, even if the <span class=
2226 "QUOTE">"Content-Type:"</span> isn't detected as such.</p>
2238 <p>As explained <tt class="LITERAL"><a href=
2239 "actions-file.html#FILTER">above</a></tt>, <span class=
2240 "APPLICATION">Privoxy</span> tries to only filter files that
2241 are in some kind of text format. The same restrictions apply to
2242 <tt class="LITERAL"><a href=
2243 "actions-file.html#CONTENT-TYPE-OVERWRITE">content-type-overwrite</a></tt>.
2244 <tt class="LITERAL">force-text-mode</tt> declares a document as
2245 text, without looking at the <span class=
2246 "QUOTE">"Content-Type:"</span> first.</p>
2247 <div class="WARNING">
2248 <table class="WARNING" border="1" width="90%">
2250 <td align="center"><b>Warning</b></td>
2254 <p>Think twice before activating this action. Filtering
2255 binary data with regular expressions can cause file
2262 <dt>Example usage:</dt>
2264 <table border="0" bgcolor="#E0E0E0" width="90%">
2267 <pre class="SCREEN">+force-text-mode
2277 <h4 class="SECT3"><a name="FORWARD-OVERRIDE" id=
2278 "FORWARD-OVERRIDE">8.5.18. forward-override</a></h4>
2279 <div class="VARIABLELIST">
2281 <dt>Typical use:</dt>
2283 <p>Change the forwarding settings based on User-Agent or
2288 <p>Overrules the forward directives in the configuration
2293 <p>Parameterized.</p>
2299 <p><span class="QUOTE">"forward ."</span> to use a direct
2300 connection without any additional proxies.</p>
2303 <p><span class="QUOTE">"forward 127.0.0.1:8123"</span> to
2304 use the HTTP proxy listening at 127.0.0.1 port 8123.</p>
2307 <p><span class="QUOTE">"forward-socks4a 127.0.0.1:9050
2308 ."</span> to use the socks4a proxy listening at 127.0.0.1
2309 port 9050. Replace <span class=
2310 "QUOTE">"forward-socks4a"</span> with <span class=
2311 "QUOTE">"forward-socks4"</span> to use a socks4 connection
2312 (with local DNS resolution) instead, use <span class=
2313 "QUOTE">"forward-socks5"</span> for socks5 connections
2314 (with remote DNS resolution).</p>
2317 <p><span class="QUOTE">"forward-socks4a 127.0.0.1:9050
2318 proxy.example.org:8000"</span> to use the socks4a proxy
2319 listening at 127.0.0.1 port 9050 to reach the HTTP proxy
2320 listening at proxy.example.org port 8000. Replace
2321 <span class="QUOTE">"forward-socks4a"</span> with
2322 <span class="QUOTE">"forward-socks4"</span> to use a socks4
2323 connection (with local DNS resolution) instead, use
2324 <span class="QUOTE">"forward-socks5"</span> for socks5
2325 connections (with remote DNS resolution).</p>
2328 <p><span class="QUOTE">"forward-webserver
2329 127.0.0.1:80"</span> to use the HTTP server listening at
2330 127.0.0.1 port 80 without adjusting the request
2332 <p>This makes it more convenient to use Privoxy to make
2333 existing websites available as onion services as well.</p>
2334 <p>Many websites serve content with hardcoded URLs and
2335 can't be easily adjusted to change the domain based on the
2336 one used by the client.</p>
2337 <p>Putting Privoxy between Tor and the webserver (or an
2338 stunnel that forwards to the webserver) allows to rewrite
2339 headers and content to make client and server happy at the
2341 <p>Using Privoxy for webservers that are only reachable
2342 through onion addresses and whose location is supposed to
2343 be secret is not recommended and should not be necessary
2350 <p>This action takes parameters similar to the <a href=
2351 "config.html#FORWARDING">forward</a> directives in the
2352 configuration file, but without the URL pattern. It can be used
2353 as replacement, but normally it's only used in cases where
2354 matching based on the request URL isn't sufficient.</p>
2355 <div class="WARNING">
2356 <table class="WARNING" border="1" width="90%">
2358 <td align="center"><b>Warning</b></td>
2362 <p>Please read the description for the <a href=
2363 "config.html#FORWARDING">forward</a> directives before
2364 using this action. Forwarding to the wrong people will
2365 reduce your privacy and increase the chances of
2366 man-in-the-middle attacks.</p>
2367 <p>If the ports are missing or invalid, default values
2368 will be used. This might change in the future and you
2369 shouldn't rely on it. Otherwise incorrect syntax causes
2370 Privoxy to exit. Due to design limitations, invalid
2371 parameter syntax isn't detected until the action is
2372 used the first time.</p>
2374 "http://config.privoxy.org/show-url-info" target=
2375 "_top">show-url-info CGI page</a> to verify that your
2376 forward settings do what you thought the do.</p>
2382 <dt>Example usage:</dt>
2384 <table border="0" bgcolor="#E0E0E0" width="90%">
2387 <pre class="SCREEN">
2388 # Use an ssh tunnel for requests previously tagged as
2389 # <span class="QUOTE">"User-Agent: fetch libfetch/2.0"</span> and make sure
2390 # resuming downloads continues to work.
2392 # This way you can continue to use Tor for your normal browsing,
2393 # without overloading the Tor network with your FreeBSD ports updates
2394 # or downloads of bigger files like ISOs.
2396 # Note that HTTP headers are easy to fake and therefore their
2397 # values are as (un)trustworthy as your clients and users.
2398 {+forward-override{forward-socks5 10.0.0.2:2222 .} \
2399 -hide-if-modified-since \
2400 -overwrite-last-modified \
2402 TAG:^User-Agent: fetch libfetch/2\.0$
2412 <h4 class="SECT3"><a name="HANDLE-AS-EMPTY-DOCUMENT" id=
2413 "HANDLE-AS-EMPTY-DOCUMENT">8.5.19. handle-as-empty-document</a></h4>
2414 <div class="VARIABLELIST">
2416 <dt>Typical use:</dt>
2418 <p>Mark URLs that should be replaced by empty documents
2419 <span class="emphasis"><i class="EMPHASIS">if they get
2420 blocked</i></span></p>
2424 <p>This action alone doesn't do anything noticeable. It just
2425 marks URLs. If the <tt class="LITERAL"><a href=
2426 "actions-file.html#BLOCK">block</a></tt> action <span class=
2427 "emphasis"><i class="EMPHASIS">also applies</i></span>, the
2428 presence or absence of this mark decides whether an HTML
2429 <span class="QUOTE">"BLOCKED"</span> page, or an empty document
2430 will be sent to the client as a substitute for the blocked
2431 content. The <span class="emphasis"><i class=
2432 "EMPHASIS">empty</i></span> document isn't literally empty, but
2433 actually contains a single space.</p>
2445 <p>Some browsers complain about syntax errors if JavaScript
2446 documents are blocked with <span class=
2447 "APPLICATION">Privoxy's</span> default HTML page; this option
2448 can be used to silence them. And of course this action can also
2449 be used to eliminate the <span class=
2450 "APPLICATION">Privoxy</span> BLOCKED message in frames.</p>
2451 <p>The content type for the empty document can be specified
2452 with <tt class="LITERAL"><a href=
2453 "actions-file.html#CONTENT-TYPE-OVERWRITE">content-type-overwrite{}</a></tt>,
2454 but usually this isn't necessary.</p>
2456 <dt>Example usage:</dt>
2458 <table border="0" bgcolor="#E0E0E0" width="90%">
2461 <pre class="SCREEN">
2462 # Block all documents on example.org that end with ".js",
2463 # but send an empty document instead of the usual HTML message.
2464 {+block{Blocked JavaScript} +handle-as-empty-document}
2475 <h4 class="SECT3"><a name="HANDLE-AS-IMAGE" id=
2476 "HANDLE-AS-IMAGE">8.5.20. handle-as-image</a></h4>
2477 <div class="VARIABLELIST">
2479 <dt>Typical use:</dt>
2481 <p>Mark URLs as belonging to images (so they'll be replaced by
2482 images <span class="emphasis"><i class="EMPHASIS">if they do
2483 get blocked</i></span>, rather than HTML pages)</p>
2487 <p>This action alone doesn't do anything noticeable. It just
2488 marks URLs as images. If the <tt class="LITERAL"><a href=
2489 "actions-file.html#BLOCK">block</a></tt> action <span class=
2490 "emphasis"><i class="EMPHASIS">also applies</i></span>, the
2491 presence or absence of this mark decides whether an HTML
2492 <span class="QUOTE">"blocked"</span> page, or a replacement
2493 image (as determined by the <tt class="LITERAL"><a href=
2494 "actions-file.html#SET-IMAGE-BLOCKER">set-image-blocker</a></tt>
2495 action) will be sent to the client as a substitute for the
2496 blocked content.</p>
2508 <p>The below generic example section is actually part of
2509 <tt class="FILENAME">default.action</tt>. It marks all URLs
2510 with well-known image file name extensions as images and should
2512 <p>Users will probably only want to use the handle-as-image
2513 action in conjunction with <tt class="LITERAL"><a href=
2514 "actions-file.html#BLOCK">block</a></tt>, to block sources of
2515 banners, whose URLs don't reflect the file type, like in the
2516 second example section.</p>
2517 <p>Note that you cannot treat HTML pages as images in most
2518 cases. For instance, (in-line) ad frames require an HTML page
2519 to be sent, or they won't display properly. Forcing <tt class=
2520 "LITERAL">handle-as-image</tt> in this situation will not
2521 replace the ad frame with an image, but lead to error
2524 <dt>Example usage (sections):</dt>
2526 <table border="0" bgcolor="#E0E0E0" width="90%">
2529 <pre class="SCREEN"># Generic image extensions:
2532 /.*\.(gif|jpg|jpeg|png|bmp|ico)$
2534 # These don't look like images, but they're banners and should be
2535 # blocked as images:
2537 {+block{Nasty banners.} +handle-as-image}
2538 nasty-banner-server.example.com/junk.cgi\?output=trash</pre>
2547 <h4 class="SECT3"><a name="HIDE-ACCEPT-LANGUAGE" id=
2548 "HIDE-ACCEPT-LANGUAGE">8.5.21. hide-accept-language</a></h4>
2549 <div class="VARIABLELIST">
2551 <dt>Typical use:</dt>
2553 <p>Pretend to use different language settings.</p>
2557 <p>Deletes or replaces the <span class=
2558 "QUOTE">"Accept-Language:"</span> HTTP header in client
2563 <p>Parameterized.</p>
2567 <p>Keyword: <span class="QUOTE">"block"</span>, or any user
2572 <p>Faking the browser's language settings can be useful to make
2573 a foreign User-Agent set with <tt class="LITERAL"><a href=
2574 "actions-file.html#HIDE-USER-AGENT">hide-user-agent</a></tt>
2575 more believable.</p>
2576 <p>However some sites with content in different languages check
2577 the <span class="QUOTE">"Accept-Language:"</span> to decide
2578 which one to take by default. Sometimes it isn't possible to
2579 later switch to another language without changing the
2580 <span class="QUOTE">"Accept-Language:"</span> header first.</p>
2581 <p>Therefore it's a good idea to either only change the
2582 <span class="QUOTE">"Accept-Language:"</span> header to
2583 languages you understand, or to languages that aren't wide
2585 <p>Before setting the <span class=
2586 "QUOTE">"Accept-Language:"</span> header to a rare language,
2587 you should consider that it helps to make your requests unique
2588 and thus easier to trace. If you don't plan to change this
2589 header frequently, you should stick to a common language.</p>
2591 <dt>Example usage (section):</dt>
2593 <table border="0" bgcolor="#E0E0E0" width="90%">
2596 <pre class="SCREEN">
2597 # Pretend to use Canadian language settings.
2598 {+hide-accept-language{en-ca} \
2599 +hide-user-agent{Mozilla/5.0 (X11; U; OpenBSD i386; en-CA; rv:1.8.0.4) Gecko/20060628 Firefox/1.5.0.4} \
2610 <h4 class="SECT3"><a name="HIDE-CONTENT-DISPOSITION" id=
2611 "HIDE-CONTENT-DISPOSITION">8.5.22. hide-content-disposition</a></h4>
2612 <div class="VARIABLELIST">
2614 <dt>Typical use:</dt>
2616 <p>Prevent download menus for content you prefer to view inside
2621 <p>Deletes or replaces the <span class=
2622 "QUOTE">"Content-Disposition:"</span> HTTP header set by some
2627 <p>Parameterized.</p>
2631 <p>Keyword: <span class="QUOTE">"block"</span>, or any user
2636 <p>Some servers set the <span class=
2637 "QUOTE">"Content-Disposition:"</span> HTTP header for documents
2638 they assume you want to save locally before viewing them. The
2639 <span class="QUOTE">"Content-Disposition:"</span> header
2640 contains the file name the browser is supposed to use by
2642 <p>In most browsers that understand this header, it makes it
2643 impossible to <span class="emphasis"><i class="EMPHASIS">just
2644 view</i></span> the document, without downloading it first,
2645 even if it's just a simple text file or an image.</p>
2646 <p>Removing the <span class=
2647 "QUOTE">"Content-Disposition:"</span> header helps to prevent
2648 this annoyance, but some browsers additionally check the
2649 <span class="QUOTE">"Content-Type:"</span> header, before they
2650 decide if they can display a document without saving it first.
2651 In these cases, you have to change this header as well, before
2652 the browser stops displaying download menus.</p>
2653 <p>It is also possible to change the server's file name
2654 suggestion to another one, but in most cases it isn't worth the
2655 time to set it up.</p>
2656 <p>This action will probably be removed in the future, use
2657 server-header filters instead.</p>
2659 <dt>Example usage:</dt>
2661 <table border="0" bgcolor="#E0E0E0" width="90%">
2664 <pre class="SCREEN">
2665 # Disarm the download link in Sourceforge's patch tracker
2667 +content-type-overwrite{text/plain}\
2668 +hide-content-disposition{block} }
2669 .sourceforge.net/tracker/download\.php</pre>
2678 <h4 class="SECT3"><a name="HIDE-IF-MODIFIED-SINCE" id=
2679 "HIDE-IF-MODIFIED-SINCE">8.5.23. hide-if-modified-since</a></h4>
2680 <div class="VARIABLELIST">
2682 <dt>Typical use:</dt>
2684 <p>Prevent yet another way to track the user's steps between
2689 <p>Deletes the <span class="QUOTE">"If-Modified-Since:"</span>
2690 HTTP client header or modifies its value.</p>
2694 <p>Parameterized.</p>
2698 <p>Keyword: <span class="QUOTE">"block"</span>, or a user
2699 defined value that specifies a range of hours.</p>
2703 <p>Removing this header is useful for filter testing, where you
2704 want to force a real reload instead of getting status code
2705 <span class="QUOTE">"304"</span>, which would cause the browser
2706 to use a cached copy of the page.</p>
2707 <p>Instead of removing the header, <tt class=
2708 "LITERAL">hide-if-modified-since</tt> can also add or subtract
2709 a random amount of time to/from the header's value. You specify
2710 a range of minutes where the random factor should be chosen
2711 from and <span class="APPLICATION">Privoxy</span> does the
2712 rest. A negative value means subtracting, a positive value
2714 <p>Randomizing the value of the <span class=
2715 "QUOTE">"If-Modified-Since:"</span> makes it less likely that
2716 the server can use the time as a cookie replacement, but you
2717 will run into caching problems if the random range is too
2719 <p>It is a good idea to only use a small negative value and let
2720 <tt class="LITERAL"><a href=
2721 "actions-file.html#OVERWRITE-LAST-MODIFIED">overwrite-last-modified</a></tt>
2722 handle the greater changes.</p>
2723 <p>It is also recommended to use this action together with
2724 <tt class="LITERAL"><a href=
2725 "actions-file.html#CRUNCH-IF-NONE-MATCH">crunch-if-none-match</a></tt>,
2726 otherwise it's more or less pointless.</p>
2728 <dt>Example usage (section):</dt>
2730 <table border="0" bgcolor="#E0E0E0" width="90%">
2733 <pre class="SCREEN">
2734 # Let the browser revalidate but make tracking based on the time less likely.
2735 {+hide-if-modified-since{-60} \
2736 +overwrite-last-modified{randomize} \
2737 +crunch-if-none-match}
2747 <h4 class="SECT3"><a name="HIDE-FROM-HEADER" id=
2748 "HIDE-FROM-HEADER">8.5.24. hide-from-header</a></h4>
2749 <div class="VARIABLELIST">
2751 <dt>Typical use:</dt>
2753 <p>Keep your (old and ill) browser from telling web servers
2754 your email address</p>
2758 <p>Deletes any existing <span class="QUOTE">"From:"</span> HTTP
2759 header, or replaces it with the specified string.</p>
2763 <p>Parameterized.</p>
2767 <p>Keyword: <span class="QUOTE">"block"</span>, or any user
2772 <p>The keyword <span class="QUOTE">"block"</span> will
2773 completely remove the header (not to be confused with the
2774 <tt class="LITERAL"><a href=
2775 "actions-file.html#BLOCK">block</a></tt> action).</p>
2776 <p>Alternately, you can specify any value you prefer to be sent
2777 to the web server. If you do, it is a matter of fairness not to
2778 use any address that is actually used by a real person.</p>
2779 <p>This action is rarely needed, as modern web browsers don't
2780 send <span class="QUOTE">"From:"</span> headers anymore.</p>
2782 <dt>Example usage:</dt>
2784 <table border="0" bgcolor="#E0E0E0" width="90%">
2787 <pre class="SCREEN">+hide-from-header{block}</pre>
2791 <table border="0" bgcolor="#E0E0E0" width="90%">
2794 <pre class="SCREEN">
2795 +hide-from-header{spam-me-senseless@sittingduck.example.com}</pre>
2804 <h4 class="SECT3"><a name="HIDE-REFERRER" id="HIDE-REFERRER">8.5.25.
2805 hide-referrer</a></h4><a name="HIDE-REFERER" id="HIDE-REFERER"></a>
2806 <div class="VARIABLELIST">
2808 <dt>Typical use:</dt>
2810 <p>Conceal which link you followed to get to a particular
2815 <p>Deletes the <span class="QUOTE">"Referer:"</span> (sic) HTTP
2816 header from the client request, or replaces it with a forged
2821 <p>Parameterized.</p>
2827 <p><span class="QUOTE">"conditional-block"</span> to delete
2828 the header completely if the host has changed.</p>
2831 <p><span class="QUOTE">"conditional-forge"</span> to forge
2832 the header if the host has changed.</p>
2835 <p><span class="QUOTE">"block"</span> to delete the header
2836 unconditionally.</p>
2839 <p><span class="QUOTE">"forge"</span> to pretend to be
2840 coming from the homepage of the server we are talking
2844 <p>Any other string to set a user defined referrer.</p>
2850 <p><tt class="LITERAL">conditional-block</tt> is the only
2851 parameter, that isn't easily detected in the server's log file.
2852 If it blocks the referrer, the request will look like the
2853 visitor used a bookmark or typed in the address directly.</p>
2854 <p>Leaving the referrer unmodified for requests on the same
2855 host allows the server owner to see the visitor's <span class=
2856 "QUOTE">"click path"</span>, but in most cases she could also
2857 get that information by comparing other parts of the log file:
2858 for example the User-Agent if it isn't a very common one, or
2859 the user's IP address if it doesn't change between different
2861 <p>Always blocking the referrer, or using a custom one, can
2862 lead to failures on servers that check the referrer before they
2863 answer any requests, in an attempt to prevent their content
2864 from being embedded or linked to elsewhere.</p>
2865 <p>Both <tt class="LITERAL">conditional-block</tt> and
2866 <tt class="LITERAL">forge</tt> will work with referrer checks,
2867 as long as content and valid referring page are on the same
2868 host. Most of the time that's the case.</p>
2869 <p><tt class="LITERAL">hide-referer</tt> is an alternate
2870 spelling of <tt class="LITERAL">hide-referrer</tt> and the two
2871 can be can be freely substituted with each other. (<span class=
2872 "QUOTE">"referrer"</span> is the correct English spelling,
2873 however the HTTP specification has a bug - it requires it to be
2874 spelled as <span class="QUOTE">"referer"</span>.)</p>
2876 <dt>Example usage:</dt>
2878 <table border="0" bgcolor="#E0E0E0" width="90%">
2881 <pre class="SCREEN">+hide-referrer{forge}</pre>
2885 <table border="0" bgcolor="#E0E0E0" width="90%">
2888 <pre class="SCREEN">
2889 +hide-referrer{http://www.yahoo.com/}</pre>
2898 <h4 class="SECT3"><a name="HIDE-USER-AGENT" id=
2899 "HIDE-USER-AGENT">8.5.26. hide-user-agent</a></h4>
2900 <div class="VARIABLELIST">
2902 <dt>Typical use:</dt>
2904 <p>Try to conceal your type of browser and client operating
2909 <p>Replaces the value of the <span class=
2910 "QUOTE">"User-Agent:"</span> HTTP header in client requests
2911 with the specified value.</p>
2915 <p>Parameterized.</p>
2919 <p>Any user-defined string.</p>
2923 <div class="WARNING">
2924 <table class="WARNING" border="1" width="90%">
2926 <td align="center"><b>Warning</b></td>
2930 <p>This can lead to problems on web sites that depend
2931 on looking at this header in order to customize their
2932 content for different browsers (which, by the way, is
2933 <span class="emphasis"><i class=
2934 "EMPHASIS">NOT</i></span> the right thing to do: good
2935 web sites work browser-independently).</p>
2940 <p>Using this action in multi-user setups or wherever different
2941 types of browsers will access the same <span class=
2942 "APPLICATION">Privoxy</span> is <span class=
2943 "emphasis"><i class="EMPHASIS">not recommended</i></span>. In
2944 single-user, single-browser setups, you might use it to delete
2945 your OS version information from the headers, because it is an
2946 invitation to exploit known bugs for your OS. It is also
2947 occasionally useful to forge this in order to access sites that
2948 won't let you in otherwise (though there may be a good reason
2950 <p>More information on known user-agent strings can be found at
2951 <a href="http://www.user-agents.org/" target=
2952 "_top">http://www.user-agents.org/</a> and <a href=
2953 "http://en.wikipedia.org/wiki/User_agent" target=
2954 "_top">http://en.wikipedia.org/wiki/User_agent</a>.</p>
2956 <dt>Example usage:</dt>
2958 <table border="0" bgcolor="#E0E0E0" width="90%">
2961 <pre class="SCREEN">
2962 +hide-user-agent{Netscape 6.1 (X11; I; Linux 2.4.18 i686)}</pre>
2971 <h4 class="SECT3"><a name="LIMIT-CONNECT" id="LIMIT-CONNECT">8.5.27.
2972 limit-connect</a></h4>
2973 <div class="VARIABLELIST">
2975 <dt>Typical use:</dt>
2977 <p>Prevent abuse of <span class="APPLICATION">Privoxy</span> as
2978 a TCP proxy relay or disable SSL for untrusted sites</p>
2982 <p>Specifies to which ports HTTP CONNECT requests are
2987 <p>Parameterized.</p>
2991 <p>A comma-separated list of ports or port ranges (the latter
2992 using dashes, with the minimum defaulting to 0 and the maximum
2997 <p>By default, i.e. if no <tt class=
2998 "LITERAL">limit-connect</tt> action applies, <span class=
2999 "APPLICATION">Privoxy</span> allows HTTP CONNECT requests to
3000 all ports. Use <tt class="LITERAL">limit-connect</tt> if
3001 fine-grained control is desired for some or all
3003 <p>The CONNECT methods exists in HTTP to allow access to secure
3004 websites (<span class="QUOTE">"https://"</span> URLs) through
3005 proxies. It works very simply: the proxy connects to the server
3006 on the specified port, and then short-circuits its connections
3007 to the client and to the remote server. This means
3008 CONNECT-enabled proxies can be used as TCP relays very
3010 <p><span class="APPLICATION">Privoxy</span> relays HTTPS
3011 traffic without seeing the decoded content. Websites can
3012 leverage this limitation to circumvent <span class=
3013 "APPLICATION">Privoxy</span>'s filters. By specifying an
3014 invalid port range you can disable HTTPS entirely.</p>
3016 <dt>Example usages:</dt>
3018 <table border="0" bgcolor="#E0E0E0" width="90%">
3021 <pre class="SCREEN">
3022 +limit-connect{443} # Port 443 is OK.
3023 +limit-connect{80,443} # Ports 80 and 443 are OK.
3024 +limit-connect{-3, 7, 20-100, 500-} # Ports less than 3, 7, 20 to 100 and above 500 are OK.
3025 +limit-connect{-} # All ports are OK
3026 +limit-connect{,} # No HTTPS/SSL traffic is allowed</pre>
3035 <h4 class="SECT3"><a name="LIMIT-COOKIE-LIFETIME" id=
3036 "LIMIT-COOKIE-LIFETIME">8.5.28. limit-cookie-lifetime</a></h4>
3037 <div class="VARIABLELIST">
3039 <dt>Typical use:</dt>
3041 <p>Limit the lifetime of HTTP cookies to a couple of minutes or
3046 <p>Overwrites the expires field in Set-Cookie server headers if
3047 it's above the specified limit.</p>
3051 <p>Parameterized.</p>
3055 <p>The lifetime limit in minutes, or 0.</p>
3059 <p>This action reduces the lifetime of HTTP cookies coming from
3060 the server to the specified number of minutes, starting from
3061 the time the cookie passes Privoxy.</p>
3062 <p>Cookies with a lifetime below the limit are not modified.
3063 The lifetime of session cookies is set to the specified
3065 <p>The effect of this action depends on the server.</p>
3066 <p>In case of servers which refresh their cookies with each
3067 response (or at least frequently), the lifetime limit set by
3068 this action is updated as well. Thus, a session associated with
3069 the cookie continues to work with this action enabled, as long
3070 as a new request is made before the last limit set is
3072 <p>However, some servers send their cookies once, with a
3073 lifetime of several years (the year 2037 is a popular choice),
3074 and do not refresh them until a certain event in the future,
3075 for example the user logging out. In this case this action may
3076 limit the absolute lifetime of the session, even if requests
3077 are made frequently.</p>
3078 <p>If the parameter is <span class="QUOTE">"0"</span>, this
3079 action behaves like <tt class="LITERAL"><a href=
3080 "actions-file.html#SESSION-COOKIES-ONLY">session-cookies-only</a></tt>.</p>
3082 <dt>Example usages:</dt>
3084 <table border="0" bgcolor="#E0E0E0" width="90%">
3087 <pre class="SCREEN">+limit-cookie-lifetime{60}
3097 <h4 class="SECT3"><a name="PREVENT-COMPRESSION" id=
3098 "PREVENT-COMPRESSION">8.5.29. prevent-compression</a></h4>
3099 <div class="VARIABLELIST">
3101 <dt>Typical use:</dt>
3103 <p>Ensure that servers send the content uncompressed, so it can
3104 be passed through <tt class="LITERAL"><a href=
3105 "actions-file.html#FILTER">filter</a></tt>s.</p>
3109 <p>Removes the Accept-Encoding header which can be used to ask
3110 for compressed transfer.</p>
3122 <p>More and more websites send their content compressed by
3123 default, which is generally a good idea and saves bandwidth.
3124 But the <tt class="LITERAL"><a href=
3125 "actions-file.html#FILTER">filter</a></tt> and <tt class=
3127 "actions-file.html#DEANIMATE-GIFS">deanimate-gifs</a></tt>
3128 actions need access to the uncompressed data.</p>
3129 <p>When compiled with zlib support (available since
3130 <span class="APPLICATION">Privoxy</span> 3.0.7), content that
3131 should be filtered is decompressed on-the-fly and you don't
3132 have to worry about this action. If you are using an older
3133 <span class="APPLICATION">Privoxy</span> version, or one that
3134 hasn't been compiled with zlib support, this action can be used
3135 to convince the server to send the content uncompressed.</p>
3136 <p>Most text-based instances compress very well, the size is
3137 seldom decreased by less than 50%, for markup-heavy instances
3138 like news feeds saving more than 90% of the original size isn't
3140 <p>Not using compression will therefore slow down the transfer,
3141 and you should only enable this action if you really need it.
3142 As of <span class="APPLICATION">Privoxy</span> 3.0.7 it's
3143 disabled in all predefined action settings.</p>
3144 <p>Note that some (rare) ill-configured sites don't handle
3145 requests for uncompressed documents correctly. Broken PHP
3146 applications tend to send an empty document body, some IIS
3147 versions only send the beginning of the content. If you enable
3148 <tt class="LITERAL">prevent-compression</tt> per default, you
3149 might want to add exceptions for those sites. See the example
3150 for how to do that.</p>
3152 <dt>Example usage (sections):</dt>
3154 <table border="0" bgcolor="#E0E0E0" width="90%">
3157 <pre class="SCREEN">
3158 # Selectively turn off compression, and enable a filter
3160 { +filter{tiny-textforms} +prevent-compression }
3161 # Match only these sites
3166 # Or instead, we could set a universal default:
3168 { +prevent-compression }
3171 # Then maybe make exceptions for broken sites:
3173 { -prevent-compression }
3183 <h4 class="SECT3"><a name="OVERWRITE-LAST-MODIFIED" id=
3184 "OVERWRITE-LAST-MODIFIED">8.5.30. overwrite-last-modified</a></h4>
3185 <div class="VARIABLELIST">
3187 <dt>Typical use:</dt>
3189 <p>Prevent yet another way to track the user's steps between
3194 <p>Deletes the <span class="QUOTE">"Last-Modified:"</span> HTTP
3195 server header or modifies its value.</p>
3199 <p>Parameterized.</p>
3203 <p>One of the keywords: <span class="QUOTE">"block"</span>,
3204 <span class="QUOTE">"reset-to-request-time"</span> and
3205 <span class="QUOTE">"randomize"</span></p>
3209 <p>Removing the <span class="QUOTE">"Last-Modified:"</span>
3210 header is useful for filter testing, where you want to force a
3211 real reload instead of getting status code <span class=
3212 "QUOTE">"304"</span>, which would cause the browser to reuse
3213 the old version of the page.</p>
3214 <p>The <span class="QUOTE">"randomize"</span> option overwrites
3215 the value of the <span class="QUOTE">"Last-Modified:"</span>
3216 header with a randomly chosen time between the original value
3217 and the current time. In theory the server could send each
3218 document with a different <span class=
3219 "QUOTE">"Last-Modified:"</span> header to track visits without
3220 using cookies. <span class="QUOTE">"Randomize"</span> makes it
3221 impossible and the browser can still revalidate cached
3223 <p><span class="QUOTE">"reset-to-request-time"</span>
3224 overwrites the value of the <span class=
3225 "QUOTE">"Last-Modified:"</span> header with the current time.
3226 You could use this option together with <tt class=
3228 "actions-file.html#HIDE-IF-MODIFIED-SINCE">hide-if-modified-since</a></tt>
3229 to further customize your random range.</p>
3230 <p>The preferred parameter here is <span class=
3231 "QUOTE">"randomize"</span>. It is safe to use, as long as the
3232 time settings are more or less correct. If the server sets the
3233 <span class="QUOTE">"Last-Modified:"</span> header to the time
3234 of the request, the random range becomes zero and the value
3235 stays the same. Therefore you should later randomize it a
3236 second time with <tt class="LITERAL"><a href=
3237 "actions-file.html#HIDE-IF-MODIFIED-SINCE">hided-if-modified-since</a></tt>,
3238 just to be sure.</p>
3239 <p>It is also recommended to use this action together with
3240 <tt class="LITERAL"><a href=
3241 "actions-file.html#CRUNCH-IF-NONE-MATCH">crunch-if-none-match</a></tt>.</p>
3243 <dt>Example usage:</dt>
3245 <table border="0" bgcolor="#E0E0E0" width="90%">
3248 <pre class="SCREEN">
3249 # Let the browser revalidate without being tracked across sessions
3250 { +hide-if-modified-since{-60} \
3251 +overwrite-last-modified{randomize} \
3252 +crunch-if-none-match}
3262 <h4 class="SECT3"><a name="REDIRECT" id="REDIRECT">8.5.31.
3264 <div class="VARIABLELIST">
3266 <dt>Typical use:</dt>
3268 <p>Redirect requests to other sites.</p>
3272 <p>Convinces the browser that the requested document has been
3273 moved to another location and the browser should get it from
3278 <p>Parameterized</p>
3282 <p>An absolute URL or a single pcrs command.</p>
3286 <p>Requests to which this action applies are answered with a
3287 HTTP redirect to URLs of your choosing. The new URL is either
3288 provided as parameter, or derived by applying a single pcrs
3289 command to the original URL.</p>
3290 <p>The syntax for pcrs commands is documented in the <a href=
3291 "filter-file.html">filter file</a> section.</p>
3292 <p>Requests can't be blocked and redirected at the same time,
3293 applying this action together with <tt class="LITERAL"><a href=
3294 "actions-file.html#BLOCK">block</a></tt> is a configuration
3295 error. Currently the request is blocked and an error message
3296 logged, the behavior may change in the future and result in
3297 Privoxy rejecting the action file.</p>
3298 <p>This action can be combined with <tt class=
3299 "LITERAL"><a href="actions-file.html#FAST-REDIRECTS">fast-redirects{check-decoded-url}</a></tt>
3300 to redirect to a decoded version of a rewritten URL.</p>
3301 <p>Use this action carefully, make sure not to create
3302 redirection loops and be aware that using your own redirects
3303 might make it possible to fingerprint your requests.</p>
3304 <p>In case of problems with your redirects, or simply to watch
3305 them working, enable <a href="config.html#DEBUG">debug
3308 <dt>Example usages:</dt>
3310 <table border="0" bgcolor="#E0E0E0" width="90%">
3313 <pre class="SCREEN">
3314 # Replace example.com's style sheet with another one
3315 { +redirect{http://localhost/css-replacements/example.com.css} }
3316 example.com/stylesheet\.css
3318 # Create a short, easy to remember nickname for a favorite site
3319 # (relies on the browser to accept and forward invalid URLs to <span class=
3320 "APPLICATION">Privoxy</span>)
3321 { +redirect{https://www.privoxy.org/user-manual/actions-file.html} }
3324 # Always use the expanded view for Undeadly.org articles
3325 # (Note the $ at the end of the URL pattern to make sure
3326 # the request for the rewritten URL isn't redirected as well)
3327 {+redirect{s@$@&mode=expanded@}}
3328 undeadly.org/cgi\?action=article&sid=\d*$
3330 # Redirect Google search requests to MSN
3331 {+redirect{s@^http://[^/]*/search\?q=([^&]*).*@http://search.msn.com/results.aspx?q=$1@}}
3334 # Redirect MSN search requests to Yahoo
3335 {+redirect{s@^http://[^/]*/results\.aspx\?q=([^&]*).*@http://search.yahoo.com/search?p=$1@}}
3336 search.msn.com//results\.aspx\?q=
3338 # Redirect http://example.com/&bla=fasel&toChange=foo (and any other value but "bar")
3339 # to http://example.com/&bla=fasel&toChange=bar
3341 # The URL pattern makes sure that the following request isn't redirected again.
3342 {+redirect{s@toChange=[^&]+@toChange=bar@}}
3343 example.com/.*toChange=(?!bar)
3345 # Add a shortcut to look up illumos bugs
3346 {+redirect{s@^http://i([0-9]+)/.*@https://www.illumos.org/issues/$1@}}
3347 # Redirected URL = http://i4974/
3348 # Redirect Destination = https://www.illumos.org/issues/4974
3349 i[0-9][0-9][0-9][0-9]*/
3351 # Redirect remote requests for this manual
3352 # to the local version delivered by Privoxy
3353 {+redirect{s@^http://www@http://config@}}
3354 www.privoxy.org/user-manual/</pre>
3363 <h4 class="SECT3"><a name="SERVER-HEADER-FILTER" id=
3364 "SERVER-HEADER-FILTER">8.5.32. server-header-filter</a></h4>
3365 <div class="VARIABLELIST">
3367 <dt>Typical use:</dt>
3369 <p>Rewrite or remove single server headers.</p>
3373 <p>All server headers to which this action applies are filtered
3374 on-the-fly through the specified regular expression based
3383 <p>The name of a server-header filter, as defined in one of the
3384 <a href="filter-file.html">filter files</a>.</p>
3388 <p>Server-header filters are applied to each header on its own,
3389 not to all at once. This makes it easier to diagnose problems,
3390 but on the downside you can't write filters that only change
3391 header x if header y's value is z. You can do that by using
3393 <p>Server-header filters are executed after the other header
3394 actions have finished and use their output as input.</p>
3395 <p>Please refer to the <a href="filter-file.html">filter file
3396 chapter</a> to learn which server-header filters are available
3397 by default, and how to create your own.</p>
3399 <dt>Example usage (section):</dt>
3401 <table border="0" bgcolor="#E0E0E0" width="90%">
3404 <pre class="SCREEN">{+server-header-filter{html-to-xml}}
3405 example.org/xml-instance-that-is-delivered-as-html
3407 {+server-header-filter{xml-to-html}}
3408 example.org/instance-that-is-delivered-as-xml-but-is-not
3418 <h4 class="SECT3"><a name="SERVER-HEADER-TAGGER" id=
3419 "SERVER-HEADER-TAGGER">8.5.33. server-header-tagger</a></h4>
3420 <div class="VARIABLELIST">
3422 <dt>Typical use:</dt>
3424 <p>Enable or disable filters based on the Content-Type
3429 <p>Server headers to which this action applies are filtered
3430 on-the-fly through the specified regular expression based
3431 substitutions, the result is used as tag.</p>
3439 <p>The name of a server-header tagger, as defined in one of the
3440 <a href="filter-file.html">filter files</a>.</p>
3444 <p>Server-header taggers are applied to each header on its own,
3445 and as the header isn't modified, each tagger <span class=
3446 "QUOTE">"sees"</span> the original.</p>
3447 <p>Server-header taggers are executed before all other header
3448 actions that modify server headers. Their tags can be used to
3449 control all of the other server-header actions, the content
3450 filters and the crunch actions (<a href=
3451 "actions-file.html#REDIRECT">redirect</a> and <a href=
3452 "actions-file.html#BLOCK">block</a>).</p>
3453 <p>Obviously crunching based on tags created by server-header
3454 taggers doesn't prevent the request from showing up in the
3455 server's log file.</p>
3457 <dt>Example usage (section):</dt>
3459 <table border="0" bgcolor="#E0E0E0" width="90%">
3462 <pre class="SCREEN">
3463 # Tag every request with the content type declared by the server
3464 {+server-header-tagger{content-type}}
3467 # If the response has a tag starting with 'image/' enable an external
3468 # filter that only applies to images.
3470 # Note that the filter is not available by default, it's just a
3471 # <tt class="LITERAL"><a href=
3472 "filter-file.html#EXTERNAL-FILTER-SYNTAX">silly example</a></tt>.
3473 {+external-filter{rotate-image} +force-text-mode}
3484 <h4 class="SECT3"><a name="SESSION-COOKIES-ONLY" id=
3485 "SESSION-COOKIES-ONLY">8.5.34. session-cookies-only</a></h4>
3486 <div class="VARIABLELIST">
3488 <dt>Typical use:</dt>
3490 <p>Allow only temporary <span class="QUOTE">"session"</span>
3491 cookies (for the current browser session <span class=
3492 "emphasis"><i class="EMPHASIS">only</i></span>).</p>
3496 <p>Deletes the <span class="QUOTE">"expires"</span> field from
3497 <span class="QUOTE">"Set-Cookie:"</span> server headers. Most
3498 browsers will not store such cookies permanently and forget
3499 them in between sessions.</p>
3511 <p>This is less strict than <tt class="LITERAL"><a href=
3512 "actions-file.html#CRUNCH-INCOMING-COOKIES">crunch-incoming-cookies</a></tt>
3513 / <tt class="LITERAL"><a href=
3514 "actions-file.html#CRUNCH-OUTGOING-COOKIES">crunch-outgoing-cookies</a></tt>
3515 and allows you to browse websites that insist or rely on
3516 setting cookies, without compromising your privacy too
3518 <p>Most browsers will not permanently store cookies that have
3519 been processed by <tt class="LITERAL">session-cookies-only</tt>
3520 and will forget about them between sessions. This makes
3521 profiling cookies useless, but won't break sites which require
3522 cookies so that you can log in for transactions. This is
3523 generally turned on for all sites, and is the recommended
3525 <p>It makes <span class="emphasis"><i class="EMPHASIS">no sense
3526 at all</i></span> to use <tt class=
3527 "LITERAL">session-cookies-only</tt> together with <tt class=
3529 "actions-file.html#CRUNCH-INCOMING-COOKIES">crunch-incoming-cookies</a></tt>
3530 or <tt class="LITERAL"><a href=
3531 "actions-file.html#CRUNCH-OUTGOING-COOKIES">crunch-outgoing-cookies</a></tt>.
3532 If you do, cookies will be plainly killed.</p>
3533 <p>Note that it is up to the browser how it handles such
3534 cookies without an <span class="QUOTE">"expires"</span> field.
3535 If you use an exotic browser, you might want to try it out to
3537 <p>This setting also has no effect on cookies that may have
3538 been stored previously by the browser before starting
3539 <span class="APPLICATION">Privoxy</span>. These would have to
3540 be removed manually.</p>
3541 <p><span class="APPLICATION">Privoxy</span> also uses the
3543 "actions-file.html#FILTER-CONTENT-COOKIES">content-cookies
3544 filter</a> to block some types of cookies. Content cookies are
3545 not effected by <tt class=
3546 "LITERAL">session-cookies-only</tt>.</p>
3548 <dt>Example usage:</dt>
3550 <table border="0" bgcolor="#E0E0E0" width="90%">
3553 <pre class="SCREEN">+session-cookies-only</pre>
3562 <h4 class="SECT3"><a name="SET-IMAGE-BLOCKER" id=
3563 "SET-IMAGE-BLOCKER">8.5.35. set-image-blocker</a></h4>
3564 <div class="VARIABLELIST">
3566 <dt>Typical use:</dt>
3568 <p>Choose the replacement for blocked images</p>
3572 <p>This action alone doesn't do anything noticeable. If
3573 <span class="emphasis"><i class="EMPHASIS">both</i></span>
3574 <tt class="LITERAL"><a href=
3575 "actions-file.html#BLOCK">block</a></tt> <span class=
3576 "emphasis"><i class="EMPHASIS">and</i></span> <tt class=
3578 "actions-file.html#HANDLE-AS-IMAGE">handle-as-image</a></tt>
3579 <span class="emphasis"><i class="EMPHASIS">also</i></span>
3580 apply, i.e. if the request is to be blocked as an image,
3581 <span class="emphasis"><i class="EMPHASIS">then</i></span> the
3582 parameter of this action decides what will be sent as a
3587 <p>Parameterized.</p>
3593 <p><span class="QUOTE">"pattern"</span> to send a built-in
3594 checkerboard pattern image. The image is visually decent,
3595 scales very well, and makes it obvious where banners were
3599 <p><span class="QUOTE">"blank"</span> to send a built-in
3600 transparent image. This makes banners disappear completely,
3601 but makes it hard to detect where <span class=
3602 "APPLICATION">Privoxy</span> has blocked images on a given
3603 page and complicates troubleshooting if <span class=
3604 "APPLICATION">Privoxy</span> has blocked innocent images,
3605 like navigation icons.</p>
3608 <p><span class="QUOTE">"<tt class=
3609 "REPLACEABLE"><i>target-url</i></tt>"</span> to send a
3610 redirect to <tt class="REPLACEABLE"><i>target-url</i></tt>.
3611 You can redirect to any image anywhere, even in your local
3612 filesystem via <span class="QUOTE">"file:///"</span> URL.
3613 (But note that not all browsers support redirecting to a
3614 local file system).</p>
3615 <p>A good application of redirects is to use special
3616 <span class="APPLICATION">Privoxy</span>-built-in URLs,
3617 which send the built-in images, as <tt class=
3618 "REPLACEABLE"><i>target-url</i></tt>. This has the same
3619 visual effect as specifying <span class=
3620 "QUOTE">"blank"</span> or <span class=
3621 "QUOTE">"pattern"</span> in the first place, but enables
3622 your browser to cache the replacement image, instead of
3623 requesting it over and over again.</p>
3629 <p>The URLs for the built-in images are <span class=
3630 "QUOTE">"http://config.privoxy.org/send-banner?type=<tt class=
3631 "REPLACEABLE"><i>type</i></tt>"</span>, where <tt class=
3632 "REPLACEABLE"><i>type</i></tt> is either <span class=
3633 "QUOTE">"blank"</span> or <span class=
3634 "QUOTE">"pattern"</span>.</p>
3635 <p>There is a third (advanced) type, called <span class=
3636 "QUOTE">"auto"</span>. It is <span class="emphasis"><i class=
3637 "EMPHASIS">NOT</i></span> to be used in <tt class=
3638 "LITERAL">set-image-blocker</tt>, but meant for use from
3639 <a href="filter-file.html">filters</a>. Auto will select the
3640 type of image that would have applied to the referring page,
3641 had it been an image.</p>
3643 <dt>Example usage:</dt>
3645 <p>Built-in pattern:</p>
3646 <table border="0" bgcolor="#E0E0E0" width="90%">
3649 <pre class="SCREEN">+set-image-blocker{pattern}</pre>
3653 <p>Redirect to the BSD daemon:</p>
3654 <table border="0" bgcolor="#E0E0E0" width="90%">
3657 <pre class="SCREEN">
3658 +set-image-blocker{http://www.freebsd.org/gifs/dae_up3.gif}</pre>
3662 <p>Redirect to the built-in pattern for better caching:</p>
3663 <table border="0" bgcolor="#E0E0E0" width="90%">
3666 <pre class="SCREEN">
3667 +set-image-blocker{http://config.privoxy.org/send-banner?type=pattern}</pre>
3676 <h3 class="SECT3"><a name="SUMMARY" id="SUMMARY">8.5.36.
3678 <p>Note that many of these actions have the potential to cause a page
3679 to misbehave, possibly even not to display at all. There are many
3680 ways a site designer may choose to design his site, and what HTTP
3681 header content, and other criteria, he may depend on. There is no way
3682 to have hard and fast rules for all sites. See the <a href=
3683 "appendix.html#ACTIONSANAT">Appendix</a> for a brief example on
3684 troubleshooting actions.</p>
3688 <h2 class="SECT2"><a name="ALIASES" id="ALIASES">8.6. Aliases</a></h2>
3689 <p>Custom <span class="QUOTE">"actions"</span>, known to <span class=
3690 "APPLICATION">Privoxy</span> as <span class="QUOTE">"aliases"</span>,
3691 can be defined by combining other actions. These can in turn be invoked
3692 just like the built-in actions. Currently, an alias name can contain
3693 any character except space, tab, <span class="QUOTE">"="</span>,
3694 <span class="QUOTE">"{"</span> and <span class="QUOTE">"}"</span>, but
3695 we <span class="emphasis"><i class="EMPHASIS">strongly
3696 recommend</i></span> that you only use <span class="QUOTE">"a"</span>
3697 to <span class="QUOTE">"z"</span>, <span class="QUOTE">"0"</span> to
3698 <span class="QUOTE">"9"</span>, <span class="QUOTE">"+"</span>, and
3699 <span class="QUOTE">"-"</span>. Alias names are not case sensitive, and
3700 are not required to start with a <span class="QUOTE">"+"</span> or
3701 <span class="QUOTE">"-"</span> sign, since they are merely textually
3703 <p>Aliases can be used throughout the actions file, but they
3704 <span class="emphasis"><i class="EMPHASIS">must be defined in a special
3705 section at the top of the file!</i></span> And there can only be one
3706 such section per actions file. Each actions file may have its own alias
3707 section, and the aliases defined in it are only visible within that
3709 <p>There are two main reasons to use aliases: One is to save typing for
3710 frequently used combinations of actions, the other one is a gain in
3711 flexibility: If you decide once how you want to handle shops by
3712 defining an alias called <span class="QUOTE">"shop"</span>, you can
3713 later change your policy on shops in <span class="emphasis"><i class=
3714 "EMPHASIS">one</i></span> place, and your changes will take effect
3715 everywhere in the actions file where the <span class=
3716 "QUOTE">"shop"</span> alias is used. Calling aliases by their purpose
3717 also makes your actions files more readable.</p>
3718 <p>Currently, there is one big drawback to using aliases, though:
3719 <span class="APPLICATION">Privoxy</span>'s built-in web-based action
3720 file editor honors aliases when reading the actions files, but it
3721 expands them before writing. So the effects of your aliases are of
3722 course preserved, but the aliases themselves are lost when you edit
3723 sections that use aliases with it.</p>
3724 <p>Now let's define some aliases...</p>
3725 <table border="0" bgcolor="#E0E0E0" width="100%">
3728 <pre class="SCREEN"> # Useful custom aliases we can use later.
3730 # Note the (required!) section header line and that this section
3731 # must be at the top of the actions file!
3735 # These aliases just save typing later:
3736 # (Note that some already use other aliases!)
3738 +crunch-all-cookies = +<a href=
3739 "actions-file.html#CRUNCH-INCOMING-COOKIES">crunch-incoming-cookies</a> +<a href="actions-file.html#CRUNCH-OUTGOING-COOKIES">crunch-outgoing-cookies</a>
3740 -crunch-all-cookies = -<a href=
3741 "actions-file.html#CRUNCH-INCOMING-COOKIES">crunch-incoming-cookies</a> -<a href="actions-file.html#CRUNCH-OUTGOING-COOKIES">crunch-outgoing-cookies</a>
3742 +block-as-image = +block{Blocked image.} +handle-as-image
3743 allow-all-cookies = -crunch-all-cookies -<a href=
3744 "actions-file.html#SESSION-COOKIES-ONLY">session-cookies-only</a> -<a href=
3745 "actions-file.html#FILTER-CONTENT-COOKIES">filter{content-cookies}</a>
3747 # These aliases define combinations of actions
3748 # that are useful for certain types of sites:
3750 fragile = -<a href="actions-file.html#BLOCK">block</a> -<a href=
3751 "actions-file.html#FILTER">filter</a> -crunch-all-cookies -<a href=
3752 "actions-file.html#FAST-REDIRECTS">fast-redirects</a> -<a href=
3753 "actions-file.html#HIDE-REFERER">hide-referrer</a> -<a href=
3754 "actions-file.html#PREVENT-COMPRESSION">prevent-compression</a>
3756 shop = -crunch-all-cookies -<a href=
3757 "actions-file.html#FILTER-ALL-POPUPS">filter{all-popups}</a>
3759 # Short names for other aliases, for really lazy people ;-)
3761 c0 = +crunch-all-cookies
3762 c1 = -crunch-all-cookies</pre>
3766 <p>...and put them to use. These sections would appear in the lower
3767 part of an actions file and define exceptions to the default actions
3768 (as specified further up for the <span class="QUOTE">"/"</span>
3770 <table border="0" bgcolor="#E0E0E0" width="100%">
3773 <pre class="SCREEN">
3774 # These sites are either very complex or very keen on
3775 # user data and require minimal interference to work:
3778 .office.microsoft.com
3779 .windowsupdate.microsoft.com
3780 # Gmail is really mail.google.com, not gmail.com
3784 # Allow cookies (for setting and retrieving your customer data)
3788 .worldpay.com # for quietpc.com
3791 # These shops require pop-ups:
3793 {-filter{all-popups} -filter{unsolicited-popups}}
3795 .overclockers.co.uk</pre>
3799 <p>Aliases like <span class="QUOTE">"shop"</span> and <span class=
3800 "QUOTE">"fragile"</span> are typically used for <span class=
3801 "QUOTE">"problem"</span> sites that require more than one action to be
3802 disabled in order to function properly.</p>
3805 <h2 class="SECT2"><a name="ACT-EXAMPLES" id="ACT-EXAMPLES">8.7. Actions
3806 Files Tutorial</a></h2>
3807 <p>The above chapters have shown <a href="actions-file.html">which
3808 actions files there are and how they are organized</a>, how actions are
3809 <a href="actions-file.html#ACTIONS">specified</a> and <a href=
3810 "actions-file.html#ACTIONS-APPLY">applied to URLs</a>, how <a href=
3811 "actions-file.html#AF-PATTERNS">patterns</a> work, and how to define
3812 and use <a href="actions-file.html#ALIASES">aliases</a>. Now, let's
3813 look at an example <tt class="FILENAME">match-all.action</tt>,
3814 <tt class="FILENAME">default.action</tt> and <tt class=
3815 "FILENAME">user.action</tt> file and see how all these pieces come
3818 <h3 class="SECT3"><a name="MATCH-ALL" id="MATCH-ALL">8.7.1.
3819 match-all.action</a></h3>
3820 <p>Remember <span class="emphasis"><i class="EMPHASIS">all actions
3821 are disabled when matching starts</i></span>, so we have to
3822 explicitly enable the ones we want.</p>
3823 <p>While the <tt class="FILENAME">match-all.action</tt> file only
3824 contains a single section, it is probably the most important one. It
3825 has only one pattern, <span class="QUOTE">"<tt class=
3826 "LITERAL">/</tt>"</span>, but this pattern <a href=
3827 "actions-file.html#AF-PATTERNS">matches all URLs</a>. Therefore, the
3828 set of actions used in this <span class="QUOTE">"default"</span>
3829 section <span class="emphasis"><i class="EMPHASIS">will be applied to
3830 all requests as a start</i></span>. It can be partly or wholly
3831 overridden by other actions files like <tt class=
3832 "FILENAME">default.action</tt> and <tt class=
3833 "FILENAME">user.action</tt>, but it will still be largely responsible
3834 for your overall browsing experience.</p>
3835 <p>Again, at the start of matching, all actions are disabled, so
3836 there is no need to disable any actions here. (Remember: a
3837 <span class="QUOTE">"+"</span> preceding the action name enables the
3838 action, a <span class="QUOTE">"-"</span> disables!). Also note how
3839 this long line has been made more readable by splitting it into
3840 multiple lines with line continuation.</p>
3841 <table border="0" bgcolor="#E0E0E0" width="100%">
3844 <pre class="SCREEN">{ \
3846 "actions-file.html#CHANGE-X-FORWARDED-FOR">change-x-forwarded-for{block}</a> \
3847 +<a href="actions-file.html#HIDE-FROM-HEADER">hide-from-header{block}</a> \
3849 "actions-file.html#SET-IMAGE-BLOCKER">set-image-blocker{pattern}</a> \
3856 <p>The default behavior is now set.</p>
3859 <h3 class="SECT3"><a name="DEFAULT-ACTION" id="DEFAULT-ACTION">8.7.2.
3860 default.action</a></h3>
3861 <p>If you aren't a developer, there's no need for you to edit the
3862 <tt class="FILENAME">default.action</tt> file. It is maintained by
3863 the <span class="APPLICATION">Privoxy</span> developers and if you
3864 disagree with some of the sections, you should overrule them in your
3865 <tt class="FILENAME">user.action</tt>.</p>
3866 <p>Understanding the <tt class="FILENAME">default.action</tt> file
3867 can help you with your <tt class="FILENAME">user.action</tt>,
3869 <p>The first section in this file is a special section for internal
3870 use that prevents older <span class="APPLICATION">Privoxy</span>
3871 versions from reading the file:</p>
3872 <table border="0" bgcolor="#E0E0E0" width="100%">
3875 <pre class="SCREEN">
3876 ##########################################################################
3877 # Settings -- Don't change! For internal Privoxy use ONLY.
3878 ##########################################################################
3880 for-privoxy-version=3.0.11</pre>
3884 <p>After that comes the (optional) alias section. We'll use the
3885 example section from the above <a href=
3886 "actions-file.html#ALIASES">chapter on aliases</a>, that also
3887 explains why and how aliases are used:</p>
3888 <table border="0" bgcolor="#E0E0E0" width="100%">
3891 <pre class="SCREEN">
3892 ##########################################################################
3894 ##########################################################################
3897 # These aliases just save typing later:
3898 # (Note that some already use other aliases!)
3900 +crunch-all-cookies = +<a href=
3901 "actions-file.html#CRUNCH-INCOMING-COOKIES">crunch-incoming-cookies</a> +<a href="actions-file.html#CRUNCH-OUTGOING-COOKIES">crunch-outgoing-cookies</a>
3902 -crunch-all-cookies = -<a href=
3903 "actions-file.html#CRUNCH-INCOMING-COOKIES">crunch-incoming-cookies</a> -<a href="actions-file.html#CRUNCH-OUTGOING-COOKIES">crunch-outgoing-cookies</a>
3904 +block-as-image = +block{Blocked image.} +handle-as-image
3905 mercy-for-cookies = -crunch-all-cookies -<a href=
3906 "actions-file.html#SESSION-COOKIES-ONLY">session-cookies-only</a> -<a href=
3907 "actions-file.html#FILTER-CONTENT-COOKIES">filter{content-cookies}</a>
3909 # These aliases define combinations of actions
3910 # that are useful for certain types of sites:
3912 fragile = -<a href="actions-file.html#BLOCK">block</a> -<a href=
3913 "actions-file.html#FILTER">filter</a> -crunch-all-cookies -<a href=
3914 "actions-file.html#FAST-REDIRECTS">fast-redirects</a> -<a href=
3915 "actions-file.html#HIDE-REFERER">hide-referrer</a>
3916 shop = -crunch-all-cookies -<a href=
3917 "actions-file.html#FILTER-ALL-POPUPS">filter{all-popups}</a></pre>
3921 <p>The first of our specialized sections is concerned with
3922 <span class="QUOTE">"fragile"</span> sites, i.e. sites that require
3923 minimum interference, because they are either very complex or very
3924 keen on tracking you (and have mechanisms in place that make them
3925 unusable for people who avoid being tracked). We will simply use our
3926 pre-defined <tt class="LITERAL">fragile</tt> alias instead of stating
3927 the list of actions explicitly:</p>
3928 <table border="0" bgcolor="#E0E0E0" width="100%">
3931 <pre class="SCREEN">
3932 ##########################################################################
3933 # Exceptions for sites that'll break under the default action set:
3934 ##########################################################################
3936 # "Fragile" Use a minimum set of actions for these sites (see alias above):
3939 .office.microsoft.com # surprise, surprise!
3940 .windowsupdate.microsoft.com
3941 mail.google.com</pre>
3945 <p>Shopping sites are not as fragile, but they typically require
3946 cookies to log in, and pop-up windows for shopping carts or item
3947 details. Again, we'll use a pre-defined alias:</p>
3948 <table border="0" bgcolor="#E0E0E0" width="100%">
3951 <pre class="SCREEN"># Shopping sites:
3955 .worldpay.com # for quietpc.com
3961 <p>The <tt class="LITERAL"><a href=
3962 "actions-file.html#FAST-REDIRECTS">fast-redirects</a></tt> action,
3963 which may have been enabled in <tt class=
3964 "FILENAME">match-all.action</tt>, breaks some sites. So disable it
3965 for popular sites where we know it misbehaves:</p>
3966 <table border="0" bgcolor="#E0E0E0" width="100%">
3969 <pre class="SCREEN">{ -<a href=
3970 "actions-file.html#FAST-REDIRECTS">fast-redirects</a> }
3974 .altavista.com/.*(like|url|link):http
3975 .altavista.com/trans.*urltext=http
3980 <p>It is important that <span class="APPLICATION">Privoxy</span>
3981 knows which URLs belong to images, so that <span class=
3982 "emphasis"><i class="EMPHASIS">if</i></span> they are to be blocked,
3983 a substitute image can be sent, rather than an HTML page. Contacting
3984 the remote site to find out is not an option, since it would destroy
3985 the loading time advantage of banner blocking, and it would feed the
3986 advertisers information about you. We can mark any URL as an image
3987 with the <tt class="LITERAL"><a href=
3988 "actions-file.html#HANDLE-AS-IMAGE">handle-as-image</a></tt> action,
3989 and marking all URLs that end in a known image file extension is a
3991 <table border="0" bgcolor="#E0E0E0" width="100%">
3994 <pre class="SCREEN">
3995 ##########################################################################
3997 ##########################################################################
3999 # Define which file types will be treated as images, in case they get
4000 # blocked further down this file:
4002 { +<a href="actions-file.html#HANDLE-AS-IMAGE">handle-as-image</a> }
4003 /.*\.(gif|jpe?g|png|bmp|ico)$</pre>
4007 <p>And then there are known banner sources. They often use scripts to
4008 generate the banners, so it won't be visible from the URL that the
4009 request is for an image. Hence we block them <span class=
4010 "emphasis"><i class="EMPHASIS">and</i></span> mark them as images in
4011 one go, with the help of our <tt class="LITERAL">+block-as-image</tt>
4012 alias defined above. (We could of course just as well use <tt class=
4013 "LITERAL">+<a href="actions-file.html#BLOCK">block</a> +<a href=
4014 "actions-file.html#HANDLE-AS-IMAGE">handle-as-image</a></tt> here.)
4015 Remember that the type of the replacement image is chosen by the
4016 <tt class="LITERAL"><a href=
4017 "actions-file.html#SET-IMAGE-BLOCKER">set-image-blocker</a></tt>
4018 action. Since all URLs have matched the default section with its
4019 <tt class="LITERAL">+<a href=
4020 "actions-file.html#SET-IMAGE-BLOCKER">set-image-blocker</a>{pattern}</tt>
4021 action before, it still applies and needn't be repeated:</p>
4022 <table border="0" bgcolor="#E0E0E0" width="100%">
4025 <pre class="SCREEN"># Known ad generators:
4030 .ad.*.doubleclick.net
4031 .a.yimg.com/(?:(?!/i/).)*$
4032 .a[0-9].yimg.com/(?:(?!/i/).)*$
4038 <p>One of the most important jobs of <span class=
4039 "APPLICATION">Privoxy</span> is to block banners. Many of these can
4040 be <span class="QUOTE">"blocked"</span> by the <tt class=
4042 "actions-file.html#FILTER">filter</a>{banners-by-size}</tt> action,
4043 which we enabled above, and which deletes the references to banner
4044 images from the pages while they are loaded, so the browser doesn't
4045 request them anymore, and hence they don't need to be blocked here.
4046 But this naturally doesn't catch all banners, and some people choose
4047 not to use filters, so we need a comprehensive list of patterns for
4048 banner URLs here, and apply the <tt class="LITERAL"><a href=
4049 "actions-file.html#BLOCK">block</a></tt> action to them.</p>
4050 <p>First comes many generic patterns, which do most of the work, by
4051 matching typical domain and path name components of banners. Then
4052 comes a list of individual patterns for specific sites, which is
4053 omitted here to keep the example short:</p>
4054 <table border="0" bgcolor="#E0E0E0" width="100%">
4057 <pre class="SCREEN">
4058 ##########################################################################
4059 # Block these fine banners:
4060 ##########################################################################
4061 { <a href="actions-file.html#BLOCK">+block{Banner ads.}</a> }
4069 /.*count(er)?\.(pl|cgi|exe|dll|asp|php[34]?)
4070 /(?:.*/)?(publicite|werbung|rekla(ma|me|am)|annonse|maino(kset|nta|s)?)/
4072 # Site-specific patterns (abbreviated):
4078 <p>It's quite remarkable how many advertisers actually call their
4079 banner servers ads.<tt class="REPLACEABLE"><i>company</i></tt>.com,
4080 or call the directory in which the banners are stored simply
4081 <span class="QUOTE">"banners"</span>. So the above generic patterns
4082 are surprisingly effective.</p>
4083 <p>But being very generic, they necessarily also catch URLs that we
4084 don't want to block. The pattern <tt class="LITERAL">.*ads.</tt> e.g.
4085 catches <span class="QUOTE">"nasty-<span class="emphasis"><i class=
4086 "EMPHASIS">ads</i></span>.nasty-corp.com"</span> as intended, but
4087 also <span class="QUOTE">"downlo<span class="emphasis"><i class=
4088 "EMPHASIS">ads</i></span>.sourcefroge.net"</span> or <span class=
4089 "QUOTE">"<span class="emphasis"><i class=
4090 "EMPHASIS">ads</i></span>l.some-provider.net."</span> So here come
4091 some well-known exceptions to the <tt class="LITERAL">+<a href=
4092 "actions-file.html#BLOCK">block</a></tt> section above.</p>
4093 <p>Note that these are exceptions to exceptions from the default!
4094 Consider the URL <span class=
4095 "QUOTE">"downloads.sourcefroge.net"</span>: Initially, all actions
4096 are deactivated, so it wouldn't get blocked. Then comes the defaults
4097 section, which matches the URL, but just deactivates the <tt class=
4098 "LITERAL"><a href="actions-file.html#BLOCK">block</a></tt> action
4099 once again. Then it matches <tt class="LITERAL">.*ads.</tt>, an
4100 exception to the general non-blocking policy, and suddenly <tt class=
4101 "LITERAL"><a href="actions-file.html#BLOCK">+block</a></tt> applies.
4102 And now, it'll match <tt class="LITERAL">.*loads.</tt>, where
4103 <tt class="LITERAL"><a href="actions-file.html#BLOCK">-block</a></tt>
4104 applies, so (unless it matches <span class="emphasis"><i class=
4105 "EMPHASIS">again</i></span> further down) it ends up with no
4106 <tt class="LITERAL"><a href="actions-file.html#BLOCK">block</a></tt>
4107 action applying.</p>
4108 <table border="0" bgcolor="#E0E0E0" width="100%">
4111 <pre class="SCREEN">
4112 ##########################################################################
4113 # Save some innocent victims of the above generic block patterns:
4114 ##########################################################################
4118 { -<a href="actions-file.html#BLOCK">block</a> }
4119 adv[io]*. # (for advogato.org and advice.*)
4120 adsl. # (has nothing to do with ads)
4121 adobe. # (has nothing to do with ads either)
4122 ad[ud]*. # (adult.* and add.*)
4123 .edu # (universities don't host banners (yet!))
4124 .*loads. # (downloads, uploads etc)
4132 www.globalintersec.com/adv # (adv = advanced)
4133 www.ugu.com/sui/ugu/adv</pre>
4137 <p>Filtering source code can have nasty side effects, so make an
4138 exception for our friends at sourceforge.net, and all paths with
4139 <span class="QUOTE">"cvs"</span> in them. Note that <tt class=
4140 "LITERAL">-<a href="actions-file.html#FILTER">filter</a></tt>
4141 disables <span class="emphasis"><i class="EMPHASIS">all</i></span>
4142 filters in one fell swoop!</p>
4143 <table border="0" bgcolor="#E0E0E0" width="100%">
4146 <pre class="SCREEN"># Don't filter code!
4148 { -<a href="actions-file.html#FILTER">filter</a> }
4153 .sourceforge.net</pre>
4157 <p>The actual <tt class="FILENAME">default.action</tt> is of course
4158 much more comprehensive, but we hope this example made clear how it
4162 <h3 class="SECT3"><a name="USER-ACTION" id="USER-ACTION">8.7.3.
4163 user.action</a></h3>
4164 <p>So far we are painting with a broad brush by setting general
4165 policies, which would be a reasonable starting point for many people.
4166 Now, you might want to be more specific and have customized rules
4167 that are more suitable to your personal habits and preferences. These
4168 would be for narrowly defined situations like your ISP or your bank,
4169 and should be placed in <tt class="FILENAME">user.action</tt>, which
4170 is parsed after all other actions files and hence has the last word,
4171 over-riding any previously defined actions. <tt class=
4172 "FILENAME">user.action</tt> is also a <span class=
4173 "emphasis"><i class="EMPHASIS">safe</i></span> place for your
4174 personal settings, since <tt class="FILENAME">default.action</tt> is
4175 actively maintained by the <span class="APPLICATION">Privoxy</span>
4176 developers and you'll probably want to install updated versions from
4178 <p>So let's look at a few examples of things that one might typically
4179 do in <tt class="FILENAME">user.action</tt>:</p>
4180 <table border="0" bgcolor="#E0E0E0" width="100%">
4183 <pre class="SCREEN">
4184 # My user.action file. <fred@example.com></pre>
4188 <p>As <a href="actions-file.html#ALIASES">aliases</a> are local to
4189 the actions file that they are defined in, you can't use the ones
4190 from <tt class="FILENAME">default.action</tt>, unless you repeat them
4192 <table border="0" bgcolor="#E0E0E0" width="100%">
4195 <pre class="SCREEN">
4196 # Aliases are local to the file they are defined in.
4197 # (Re-)define aliases for this file:
4201 # These aliases just save typing later, and the alias names should
4202 # be self explanatory.
4204 +crunch-all-cookies = +crunch-incoming-cookies +crunch-outgoing-cookies
4205 -crunch-all-cookies = -crunch-incoming-cookies -crunch-outgoing-cookies
4206 allow-all-cookies = -crunch-all-cookies -session-cookies-only
4207 allow-popups = -filter{all-popups}
4208 +block-as-image = +block{Blocked as image.} +handle-as-image
4209 -block-as-image = -block
4211 # These aliases define combinations of actions that are useful for
4212 # certain types of sites:
4214 fragile = -block -crunch-all-cookies -filter -fast-redirects -hide-referrer
4215 shop = -crunch-all-cookies allow-popups
4217 # Allow ads for selected useful free sites:
4219 allow-ads = -block -filter{banners-by-size} -filter{banners-by-link}
4221 # Alias for specific file types that are text, but might have conflicting
4222 # MIME types. We want the browser to force these to be text documents.
4223 handle-as-text = -<a href="actions-file.html#FILTER">filter</a> +-<a href=
4224 "actions-file.html#CONTENT-TYPE-OVERWRITE">content-type-overwrite{text/plain}</a> +-<a href="actions-file.html#FORCE-TEXT-MODE">force-text-mode</a> -<a href="actions-file.html#HIDE-CONTENT-DISPOSITION">hide-content-disposition</a></pre>
4228 <p>Say you have accounts on some sites that you visit regularly, and
4229 you don't want to have to log in manually each time. So you'd like to
4230 allow persistent cookies for these sites. The <tt class=
4231 "LITERAL">allow-all-cookies</tt> alias defined above does exactly
4232 that, i.e. it disables crunching of cookies in any direction, and the
4233 processing of cookies to make them only temporary.</p>
4234 <table border="0" bgcolor="#E0E0E0" width="100%">
4237 <pre class="SCREEN">{ allow-all-cookies }
4245 <p>Your bank is allergic to some filter, but you don't know which, so
4246 you disable them all:</p>
4247 <table border="0" bgcolor="#E0E0E0" width="100%">
4250 <pre class="SCREEN">{ -<a href=
4251 "actions-file.html#FILTER">filter</a> }
4252 .your-home-banking-site.com</pre>
4256 <p>Some file types you may not want to filter for various
4258 <table border="0" bgcolor="#E0E0E0" width="100%">
4261 <pre class="SCREEN">
4262 # Technical documentation is likely to contain strings that might
4263 # erroneously get altered by the JavaScript-oriented filters:
4268 # And this stupid host sends streaming video with a wrong MIME type,
4269 # so that Privoxy thinks it is getting HTML and starts filtering:
4271 stupid-server.example.com/</pre>
4275 <p>Example of a simple <a href="actions-file.html#BLOCK">block</a>
4276 action. Say you've seen an ad on your favourite page on example.com
4277 that you want to get rid of. You have right-clicked the image,
4278 selected <span class="QUOTE">"copy image location"</span> and pasted
4279 the URL below while removing the leading http://, into a <tt class=
4280 "LITERAL">{ +block{} }</tt> section. Note that <tt class="LITERAL">{
4281 +handle-as-image }</tt> need not be specified, since all URLs ending
4282 in <tt class="LITERAL">.gif</tt> will be tagged as images by the
4283 general rules as set in default.action anyway:</p>
4284 <table border="0" bgcolor="#E0E0E0" width="100%">
4287 <pre class="SCREEN">{ +<a href=
4288 "actions-file.html#BLOCK">block</a>{Nasty ads.} }
4289 www.example.com/nasty-ads/sponsor\.gif
4290 another.example.net/more/junk/here/</pre>
4294 <p>The URLs of dynamically generated banners, especially from large
4295 banner farms, often don't use the well-known image file name
4296 extensions, which makes it impossible for <span class=
4297 "APPLICATION">Privoxy</span> to guess the file type just by looking
4298 at the URL. You can use the <tt class="LITERAL">+block-as-image</tt>
4299 alias defined above for these cases. Note that objects which match
4300 this rule but then turn out NOT to be an image are typically rendered
4301 as a <span class="QUOTE">"broken image"</span> icon by the browser.
4303 <table border="0" bgcolor="#E0E0E0" width="100%">
4306 <pre class="SCREEN">{ +block-as-image }
4310 ar.atwola.com/</pre>
4314 <p>Now you noticed that the default configuration breaks Forbes
4315 Magazine, but you were too lazy to find out which action is the
4316 culprit, and you were again too lazy to give <a href=
4317 "contact.html">feedback</a>, so you just used the <tt class=
4318 "LITERAL">fragile</tt> alias on the site, and -- <span class=
4319 "emphasis"><i class="EMPHASIS">whoa!</i></span> -- it worked. The
4320 <tt class="LITERAL">fragile</tt> aliases disables those actions that
4321 are most likely to break a site. Also, good for testing purposes to
4322 see if it is <span class="APPLICATION">Privoxy</span> that is causing
4323 the problem or not. We later find other regular sites that misbehave,
4324 and add those to our personalized list of troublemakers:</p>
4325 <table border="0" bgcolor="#E0E0E0" width="100%">
4328 <pre class="SCREEN">{ fragile }
4335 <p>You like the <span class="QUOTE">"fun"</span> text replacements in
4336 <tt class="FILENAME">default.filter</tt>, but it is disabled in the
4337 distributed actions file. So you'd like to turn it on in your
4338 private, update-safe config, once and for all:</p>
4339 <table border="0" bgcolor="#E0E0E0" width="100%">
4342 <pre class="SCREEN">{ +<a href=
4343 "actions-file.html#FILTER-FUN">filter{fun}</a> }
4344 / # For ALL sites!</pre>
4348 <p>Note that the above is not really a good idea: There are
4349 exceptions to the filters in <tt class="FILENAME">default.action</tt>
4350 for things that really shouldn't be filtered, like code on
4351 CVS->Web interfaces. Since <tt class="FILENAME">user.action</tt>
4352 has the last word, these exceptions won't be valid for the
4353 <span class="QUOTE">"fun"</span> filtering specified here.</p>
4354 <p>You might also worry about how your favourite free websites are
4355 funded, and find that they rely on displaying banner advertisements
4356 to survive. So you might want to specifically allow banners for those
4357 sites that you feel provide value to you:</p>
4358 <table border="0" bgcolor="#E0E0E0" width="100%">
4361 <pre class="SCREEN">{ allow-ads }
4368 <p>Note that <tt class="LITERAL">allow-ads</tt> has been aliased to
4369 <tt class="LITERAL">-<a href=
4370 "actions-file.html#BLOCK">block</a></tt>, <tt class=
4372 "actions-file.html#FILTER-BANNERS-BY-SIZE">filter{banners-by-size}</a></tt>,
4373 and <tt class="LITERAL">-<a href=
4374 "actions-file.html#FILTER-BANNERS-BY-LINK">filter{banners-by-link}</a></tt>
4376 <p>Invoke another alias here to force an over-ride of the MIME type
4377 <tt class="LITERAL">application/x-sh</tt> which typically would open
4378 a download type dialog. In my case, I want to look at the shell
4379 script, and then I can save it should I choose to.</p>
4380 <table border="0" bgcolor="#E0E0E0" width="100%">
4383 <pre class="SCREEN">{ handle-as-text }
4388 <p><tt class="FILENAME">user.action</tt> is generally the best place
4389 to define exceptions and additions to the default policies of
4390 <tt class="FILENAME">default.action</tt>. Some actions are safe to
4391 have their default policies set here though. So let's set a default
4392 policy to have a <span class="QUOTE">"blank"</span> image as opposed
4393 to the checkerboard pattern for <span class="emphasis"><i class=
4394 "EMPHASIS">ALL</i></span> sites. <span class="QUOTE">"/"</span> of
4395 course matches all URL paths and patterns:</p>
4396 <table border="0" bgcolor="#E0E0E0" width="100%">
4399 <pre class="SCREEN">{ +<a href=
4400 "actions-file.html#SET-IMAGE-BLOCKER">set-image-blocker{blank}</a> }
4408 <div class="NAVFOOTER">
4409 <hr align="left" width="100%">
4410 <table summary="Footer navigation table" width="100%" border="0"
4411 cellpadding="0" cellspacing="0">
4413 <td width="33%" align="left" valign="top"><a href="config.html"
4414 accesskey="P">Prev</a></td>
4415 <td width="34%" align="center" valign="top"><a href="index.html"
4416 accesskey="H">Home</a></td>
4417 <td width="33%" align="right" valign="top"><a href="filter-file.html"
4418 accesskey="N">Next</a></td>
4421 <td width="33%" align="left" valign="top">The Main Configuration
4423 <td width="34%" align="center" valign="top"> </td>
4424 <td width="33%" align="right" valign="top">Filter Files</td>