X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=doc%2Fwebserver%2Fuser-manual%2Factions-file.html;h=25f310e3a5398d5e3dc6a75d0a03c2c7256b1d17;hb=e3c12117d30c2f42bd47c929099f95295f2c3404;hp=64c5b9b372ef34a405710643429a66aa64338c4b;hpb=d74ec2c8f9726f42df2ce1e45749d74dee43b781;p=privoxy.git diff --git a/doc/webserver/user-manual/actions-file.html b/doc/webserver/user-manual/actions-file.html index 64c5b9b3..25f310e3 100644 --- a/doc/webserver/user-manual/actions-file.html +++ b/doc/webserver/user-manual/actions-file.html @@ -1,13 +1,13 @@ +
The actions files are used to define what actions
+> The actions files are used to define what actions
Privoxy takes for which URLs, and thus determine
+> takes for which URLs, and thus determines
how ad images, cookies and various other aspects of HTTP content and
- transactions are handled, and on which sites (or even parts thereof). There
- are three such files included with There
+ are three action files included with Privoxy
- with differing purposes:
-
match-all.action - is used to define which + "actions" relating to banner-blocking, images, pop-ups, + content modification, cookie handling etc should be applied by default. + It should be the first actions file loaded +
default.action - is the primary action file - that sets the initial values for all actions. It is intended to - provide a base level of functionality for - Privoxy's array of features. So it is - a set of broad rules that should work reasonably well for users everywhere. - This is the file that the developers are keeping updated, and making available to users. -
- defines many exceptions (both + positive and negative) from the default set of actions that's configured + in match-all.action. It is a set of rules that should + work reasonably well as-is for most users. This file is only supposed to + be edited by the developers. It should be the second actions file loaded. +user.action - is intended to be for local site - preferences and exceptions. As an example, if your ISP or your bank - has specific requirements, and need special handling, this kind of - thing should go here. This file will not be upgraded. -
standard.action - is used by the web based editor, - to set various pre-defined sets of rules for the default actions section - in default.action. These have increasing levels of - aggressiveness Edit Set to Cautious Set to Medium Set to Advanced +
These have increasing levels of aggressiveness and have no influence on your browsing unless - you select them explicitly in the editorand have no + influence on your browsing unless you select them explicitly in the + editor. It is not recommend - to edit this file. -
. A default installation should be pre-set to + Cautious. New users should try this for a while before + adjusting the settings to more aggressive levels. The more aggressive + the settings, then the more likelihood there is of problems such as sites + not working as they should. +The default profiles, and their associated actions, as pre-defined in - The Edit button allows you to turn each + action on/off individually for fine-tuning. The Cautious + button changes the actions list to low/safe settings which will activate + ad blocking and a minimal set of Privoxy's features, and subsequently + there will be less of a chance for accidental problems. The + Medium button sets the list to a medium level of + other features and a low level set of privacy features. The + Advanced button sets the list to a high level of + ad blocking and medium level of privacy. See the chart below. The latter + three buttons over-ride any changes via with the + Edit button. More fine-tuning can be done in the + lower sections of this internal page. +
While the actions file editor allows to enable these settings in all + actions files, they are only supposed to be enabled in the first one + to make sure you don't unintentionally overrule earlier rules. +
The default profiles, and their associated actions, as pre-defined in + standard.actiondefault.action are: -
Feature | Cautious | Medium | Adventuresome | Advanced
---|---|---|---|
Ad-blocking by URL | Ad-blocking Aggressivenessyes | mediumyes | highyes | high
Ad-filtering by size | yes | yes | yes |
GIF de-animation | no | yes | yes |
Referer forging | Ad-filtering by linkno | yes | noyes |
Cookie handling | Pop-up killingnone | blocks onlysession-only | blocks onlykill | blocks only
Pop-up killing | Privacy Featuresunsolicited | lowunsolicited | mediumall | medium/high
Fast redirects | Cookie handlingno | noneno | session-onlyyes | kill
HTML taming | Referer forgingyes | noyes | yes |
JavaScript taming | GIF de-animationyes | noyes | yes |
Web-bug killing | Fast redirectsyes | noyes | noyes |
Fun text replacements | HTML tamingno | no | yes |
Image tag reordering | JavaScript tamingno | no | yes |
Ad-filtering by link | Web-bug killingno | no | yesyes |
Demoronizer | Image tag reorderingno | no | yesyes |
{ +handle-as-image +block{Banner ads.} } + # Block these as if they were images. Send no block page. + banners.example.com + media.example.com/.*banners + .example.com/images/ads/ |
You can trace this process for any given URL by visiting You can trace this process for URL patterns and any given URL by visiting http://config.privoxy.org/show-url-info.
More detail on this is provided in the Appendix, Examples and more detail on this is provided in the Appendix, Anatomy of an Action.
Troubleshooting: Anatomy of an Action section.As mentioned, "patterns" - to determine what actions might apply to which sites and pages your browser - attempts to access. These actions might apply to which sites and + pages your browser attempts to access. These "patterns" use wild card type - use wild + card type pattern matching to achieve a high degree of +> matching to achieve a high degree of flexibility. This allows one expression to be expanded and potentially match against many similar patterns.
Generally, a Privoxy pattern has the form +> Generally, an URL pattern has the form <domain>/<path>, where both the +><domain><port>/<path>, where the <domain> and , the <port> + and the <path> are - optional. (This is why the special are optional. (This is why the special + / pattern matches all - URLs). Note that the protocol portion of the URL pattern (e.g. - pattern matches all URLs). Note that the protocol + portion of the URL pattern (e.g. http://) should ) should + not be included in - the pattern. This is assumed already!
be included in the pattern. This is assumed already!The pattern matching syntax is different for the domain and path parts of + the URL. The domain part uses a simple globbing type matching technique, + while the path part uses more flexible + "Regular + Expressions" (POSIX 1003.2).
The port part of a pattern is a decimal port number preceded by a colon + (:). If the domain part contains a numerical IPv6 address, + it has to be put into angle brackets + (<, >).
matches only the single document matches all the documents on /index.htmlwww.example.com - on www.example.com/index.html.
matches only the single document /index.html + on www.example.com. +
any web server. +> web server anywhere. +
Matches any URL pointing to TCP port 8000. +
Matches any URL with the host address 2001:db8::1. + (Note that the real URL uses plain brackets, not angle brackets.)
matches nothing, since it would be interpreted as a domain name and +> matches nothing, since it would be interpreted as a domain name and there is no top-level domain called .html. +>. So its + a mistake.
The matching of the domain part offers some flexible options: if the domain starts or ends with a dot, it becomes unanchored at that end. @@ -888,17 +926,29 @@ CLASS="LITERAL" >
matches any domain that ENDS in - matches any domain with first-level domain .example.comcom + and second-level domain example. + For example www.example.com, + example.com and foo.bar.baz.example.com. + Note that it wouldn't match if the second-level domain was another-example.
Additionally, there are wild-cards that you can use in the domain names - themselves. They work pretty similar to shell wild-cards: "*" - stands for zero or more arbitrary characters, represents zero or more arbitrary characters (this is + equivalent to the + "Regular + Expression" based syntax of ".*"), + "?" stands for - any single character, you can define character classes in square - brackets and all of that can be freely mixed:
represents any single character (this is equivalent to the + regular expression syntax of a simple "."), and you can define + "character classes" in square brackets which is similar to + the same regular expression technique. All of this can be freely mixed:While flexible, this is not the sophistication of full regular expression based syntax.
Privoxy uses Perl compatible regular expressions - (through the uses "modern" POSIX 1003.2 + PCRE library) for - matching the path.
"Regular + Expressions" for matching the path portion (after the slash), + and is thus more flexible.There is an Appendix with a brief quick-start into regular - expressions, and full (very technical) documentation on PCRE regex syntax is available on-line - at http://www.pcre.org/man.txt. - You might also find the Perl man page on regular expressions (man perlre) - useful, which is available on-line at http://www.perldoc.com/perl5.6/pod/perlre.html.
man re_format).Note that the path pattern is automatically left-anchored at the exactly this capitalization.
Is equivalent to just ".example.com", since any documents + within that domain are matched with or without the ".*" + regular expression. This is redundant +
Will match any page in the domain of "example.com" that is + named "index.html", and that is part of some path. For + example, it matches "www.example.com/testing/index.html" but + NOT "www.example.com/index.html" because the regular + expression called for at least two "/'s", thus the path + requirement. It also would match + "www.example.com/testing/index_html", because of the + special meta-character ".". +
This regular expression is conditional so it will match any page + named "index.html" regardless of path which in this case can + have one or more "/'s". And this one must contain exactly + ".html" (but does not have to end with that!). +
This regular expression will match any path of "example.com" + that contains any of the words "ads", "banner", + "banners" (because of the "?") or "junk". + The path does not have to end in these words, just contain them. +
This is very much the same as above, except now it must end in either + ".jpg", ".jpeg", ".gif" or ".png". So this + one is limited to common image formats. +
There are many, many good examples to be found in default.action, + and more tutorials below in Appendix on regular expressions.
Tag patterns are used to change the applying actions based on the + request's tags. Tags can be created with either the + client-header-tagger + or the server-header-tagger action.
Tag patterns have to start with "TAG:", so Privoxy + can tell them apart from URL patterns. Everything after the colon + including white space, is interpreted as a regular expression with + path pattern syntax, except that tag patterns aren't left-anchored + automatically (Privoxy doesn't silently add a "^", + you have to do it yourself if you need it).
To match all requests that are tagged with "foo" + your pattern line should be "TAG:^foo$", + "TAG:foo" would work as well, but it would also + match requests whose tags contain "foo" somewhere. + "TAG: foo" wouldn't work as it requires white space.
Sections can contain URL and tag patterns at the same time, + but tag patterns are checked after the URL patterns and thus + always overrule them, even if they are located before the URL patterns.
Once a new tag is added, Privoxy checks right away if it's matched by one + of the tag patterns and updates the action settings accordingly. As a result + tags can be used to activate other tagger actions, as long as these other + taggers look for headers that haven't already be parsed.
For example you could tag client requests which use the + POST method, + then use this tag to activate another tagger that adds a tag if cookies + are sent, and then use a block action based on the cookie tag. This allows + the outcome of one action, to be input into a subsequent action. However if + you'd reverse the position of the described taggers, and activated the + method tagger based on the cookie tagger, no method tags would be created. + The method tagger would look for the request line, but at the time + the cookie tag is created, the request line has already been parsed.
While this is a limitation you should be aware of, this kind of + indirection is seldom needed anyway and even the example doesn't + make too much sense.
All actions are disabled by default, until they are explicitly enabled somewhere in an actions file. Actions are turned on if preceded with a @@ -1185,7 +1509,7 @@ CLASS="LITERAL" of the actions file.
- There are three classes of actions:
Example: +block+handle-as-image Example: +hide-user-agent{ Mozilla 1.0 }+hide-user-agent{Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.8.1.4) Gecko/20070602 Firefox/2.0.0.4} Privoxy would just be a - normal, non-blocking, non-anonymizing proxy. You must specifically enable the + normal, non-blocking, non-filtering proxy. You must specifically enable the privacy and blocking features you need (although the provided default actions files will give a good starting point).
Later defined actions always over-ride earlier ones. So exceptions - to any rules you make, should come in the latter part of the file (or - in a file that is processed later when using multiple actions files). For - multi-valued actions, the actions are applied in the order they are specified. - Actions files are processed in the order they are defined in - Later defined action sections always over-ride earlier ones of the same type. + So exceptions to any rules you make, should come in the latter part of the file (or + in a file that is processed later when using multiple actions files such + as user.action). For multi-valued actions, the actions + are applied in the order they are specified. Actions files are processed in + the order they are defined in config (the default installation has three actions - files). It also quite possible for any given URL pattern to match more than - one pattern and thus more than one set of actions!
(the default + installation has three actions files). It also quite possible for any given + URL to match more than one "pattern" (because of wildcards and + regular expressions), and thus to trigger more than one set of actions! Last + match wins. The list of valid Confuse log analysis, custom applications Sends a user defined HTTP header to the web server.
+ Multi-value. Any string value is possible. Validity of the defined HTTP headers is not checked.
+ It is recommended that you use the "X-" prefix
+ for custom headers.
+ This action may be specified multiple times, in order to define multiple
+ headers. This is rarely needed for the typical user. If you don't know what
+ "HTTP headers" are, you definitely don't need to worry about this
+ one.
+ Headers added by this action are not modified by other actions.
+ 8.5.1. add-header
8.5.1. add-header
+ +add-header{X-User-Tracking: sucks}
Block ads or other unwanted content
Requests for URLs to which this action applies are blocked, i.e. the + requests are trapped by Privoxy and the requested URL is never retrieved, + but is answered locally with a substitute page or image, as determined by + the handle-as-image, + set-image-blocker, and + handle-as-empty-document actions. + +
Parameterized.
A block reason that should be given to the user.
Privoxy sends a special "BLOCKED" page + for requests to blocked pages. This page contains the block reason given as + parameter, a link to find out why the block action applies, and a click-through + to the blocked content (the latter only if the force feature is available and + enabled). +
+ A very important exception occurs if both + block and handle-as-image, + apply to the same request: it will then be replaced by an image. If + set-image-blocker + (see below) also applies, the type of image will be determined by its parameter, + if not, the standard checkerboard pattern is sent. +
It is important to understand this process, in order + to understand how Privoxy deals with + ads and other unwanted content. Blocking is a core feature, and one + upon which various other features depend. +
The filter + action can perform a very similar task, by "blocking" + banner images and other content through rewriting the relevant URLs in the + document's HTML source, so they don't get requested in the first place. + Note that this is a totally different technique, and it's easy to confuse the two. +
{+block{No nasty stuff for you.}} +# Block and replace with "blocked" page + .nasty-stuff.example.com + +{+block{Doubleclick banners.} +handle-as-image} +# Block and replace with image + .ad.doubleclick.net + .ads.r.us/banners/ + +{+block{Layered ads.} +handle-as-empty-document} +# Block and then ignore + adserver.example.net/.*\.js$ |
Confuse log analysis, custom applications
Improve privacy by not forwarding the source of the request in the HTTP headers.Sends a user defined HTTP header to the web server. +> Deletes the "X-Forwarded-For:" HTTP header from the client request, + or adds a new one.
Multi-value.
Parameterized.Any string value is possible. Validity of the defined HTTP headers is not checked. - It is recommended that you use the
"X-" prefix - for custom headers. -
"block" to delete the header."add" to create the header (or append + the client's IP address to an already existing one). +
This action may be specified multiple times, in order to define multiple - headers. This is rarely needed for the typical user. If you don't know what - "HTTP headers" are, you definitely don't need to worry about this - one. +> It is safe and recommended to use block. +
Forwarding the source address of the request may make + sense in some multi-user setups but is also a privacy risk.
+add-header{X-User-Tracking: sucks}+change-x-forwarded-for{block}
Block ads or other obnoxious content
Rewrite or remove single client headers. +Requests for URLs to which this action applies are blocked, i.e. the requests are not - forwarded to the remote server, but answered locally with a substitute page or image, - as determined by the handle-as-image - and set-image-blocker actions. +> All client headers to which this action applies are filtered on-the-fly through + the specified regular expression based substitutions.
Boolean.
Parameterized.N/A
The name of a client-header filter, as defined in one of the + filter files. +Privoxy sends a special "BLOCKED" page - for requests to blocked pages. This page contains links to find out why the request - was blocked, and a click-through to the blocked content (the latter only if compiled with the - force feature enabled). The "BLOCKED" page adapts to the available - screen space -- it displays full-blown if space allows, or miniaturized and text-only - if loaded into a small frame or window. If you are using Client-header filters are applied to each header on its own, not to + all at once. This makes it easier to diagnose problems, but on the downside + you can't write filters that only change header x if header y's value is z. + You can do that by using tags though. +
Client-header filters are executed after the other header actions have finished + and use their output as input. +
If the request URL gets changed, Privoxy will detect that and use the new + one. This can be used to rewrite the request destination behind the client's + back, for example to specify a Tor exit relay for certain requests. +
Please refer to the filter file chapter - right now, you can take a look at the - "BLOCKED" - page. + to learn which client-header filters are available by default, and how to + create your own.
- A very important exception occurs if both - block and handle-as-image, - apply to the same request: it will then be replaced by an image. If - set-image-blocker
# Hide Tor exit notation in Host and Referer Headers +{+client-header-filter{hide-tor-exit-notation}} +/ + |
Block requests based on their headers.
It is important to understand this process, in order - to understand how Privoxy deals with - ads and other unwanted content. +> Client headers to which this action applies are filtered on-the-fly through + the specified regular expression based substitutions, the result is used as + tag.
The filter - action can perform a very similar task, by Parameterized.
The name of a client-header tagger, as defined in one of the + filter files. +
Client-header taggers are applied to each header on its own, + and as the header isn't modified, each tagger "blocking""sees" - banner images and other content through rewriting the relevant URLs in the - document's HTML source, so they don't get requested in the first place. - Note that this is a totally different technique, and it's easy to confuse the two. + the original. +
Client-header taggers are the first actions that are executed + and their tags can be used to control every other action.
{+block} # Block and replace with "blocked" page -.nasty-stuff.example.com +># Tag every request with the User-Agent header +{+client-header-tagger{user-agent}} +/ -{+block +handle-as-image} # Block and replace with image -.ad.doubleclick.net -.ads.r.us
Most of the time it's easier to enable +> Most of the time it's easier to replace this action with a custom filter-server-headersserver-header filter - and replace this action with a custom regular expression. It allows you - to activate it for every document of a certain site and it will still +>. + It allows you to activate it for every document of a certain site and it will still only replace the content types you aimed at.
# Check if www.example.net/ really uses valid XHTML -{+content-type-overwrite {application/xml}} +{ +content-type-overwrite{application/xml} } www.example.net/ + # but leave the content type unmodified if the URL looks like a style sheet {-content-type-overwrite} -www.example.net/*.\.css$ -www.example.net/*.style8.5.4. crunch-server-header8.5.7. crunch-client-header
Deletes every header send by the client that contains the string the user supplied as parameter. +> Deletes every header sent by the client that contains the string the user supplied as parameter.
# Block the non-existent "Privacy-Violation:" client header -{+crunch-client-header {Privacy-Violation:}} +{ +crunch-client-header{Privacy-Violation:} } /8.5.5. crunch-if-none-match8.5.8. crunch-if-none-match
It is also useful to make sure the header isn't used as a cookie - replacement. + replacement (unlikely but possible).
Blocking the "If-Modified-Since:" header - isn't blocked as well. + isn't blocked or missing as well.
It is recommended to use this action together with @@ -2066,10 +2707,11 @@ WIDTH="90%" >
# Let the browser revalidate cached documents without being tracked across sessions -{+hide-if-modified-since {-1} \ -+overwrite-last-modified {randomize} \ -+crunch-if-none-match} +># Let the browser revalidate cached documents but don't +# allow the server to use the revalidation headers for user tracking. +{+hide-if-modified-since{-60} \ + +overwrite-last-modified{randomize} \ + +crunch-if-none-match} /
Prevent the web server from setting any cookies on your system +> Prevent the web server from setting HTTP cookies on your system
It makes 8.5.7. crunch-server-header8.5.10. crunch-server-header
# Crunch server headers that try to prevent caching -{+crunch-server-header {no-cache}} +{ +crunch-server-header{no-cache} } /8.5.8. crunch-outgoing-cookies8.5.11. crunch-outgoing-cookies
Prevent the web server from reading any cookies from your system +> Prevent the web server from reading any HTTP cookies from your system
To detect a redirection URL,
- +fast-redirects{simple-check}
+fast-redirects{check-decoded-url}{ +fast-redirects{simple-check} } + one.example.com + + { +fast-redirects{check-decoded-url} } + another.example.com/testing |
Get rid of HTML and JavaScript annoyances, banner advertisements (by size), do fun text replacements, etc.
Get rid of HTML and JavaScript annoyances, banner advertisements (by size), + do fun text replacements, add personalized effects, etc.All files of text-based type, most notably HTML and JavaScript, to which this - action applies, are filtered on-the-fly through the specified regular expression - based substitutions. (Note: as of version 3.0.3 plain text documents +> All instances of text-based type, most notably HTML and JavaScript, to which + this action applies, can be filtered on-the-fly through the specified regular + expression based substitutions. (Note: as of version 3.0.3 plain text documents are exempted from filtering, because web servers often use the - text/plain MIME type for all files whose type they - don't know.) +> MIME type for all files whose type they don't know.)
The name of a filter, as defined in the The name of a content filter, as defined in the filter file. @@ -2883,7 +3513,13 @@ CLASS="FILENAME"
When used in its negative form, - and without parameters, filtering is completely disabled. + and without parameters, all filtering is completely disabled.
This is very powerful feature, and "rolling your own""Rolling your own" - filters requires a knowledge of regular expressions and HTML. + filters requires a knowledge of + "Regular + Expressions" and + "HTML". + This is very powerful feature, and potentially very intrusive. + Filters should be used with caution, and where an equivalent + "action" is not available.
The amount of data that can be filtered is limited to the @@ -2925,7 +3584,7 @@ HREF="config.html" data, and all pending data, is passed through unfiltered.
Inadequate MIME types, such as zipped files, are not filtered at all. +> Inappropriate MIME types, such as zipped files, are not filtered at all. (Again, only text-based types except plain text). Encrypted SSL data (from HTTPS servers) cannot be filtered either, since this would violate the integrity of the secure transaction. In some situations it might @@ -2933,16 +3592,30 @@ HREF="config.html" by defining appropriate -filter sections. +> exceptions.
At this time, Compressed content can't be filtered either, unless Privoxy cannot (yet!) uncompress compressed - documents. If you want filtering to work on all documents, even those that - would normally be sent compressed, use the - + is compiled with zlib support (requires at least Privoxy 3.0.7), + in which case Privoxy will decompress the content before filtering + it. +
If you use a Privoxy version without zlib support, but want filtering to work on + as much documents as possible, even those that would normally be sent compressed, + you must use the .
Filtering can achieve some of the same effects as the
+> Content filtering can achieve some of the same effects as the
+filter{js-annoyances} # Get rid of particularly annoying JavaScript abuse
+filter{js-annoyances} # Get rid of particularly annoying JavaScript abuse.+filter{js-events} # Kill all JS event bindings (Radically destructive! Only for extra nasty sites)
+filter{js-events} # Kill all JS event bindings and timers (Radically destructive! Only for extra nasty sites).+filter{html-annoyances} # Get rid of particularly annoying HTML abuse
+filter{html-annoyances} # Get rid of particularly annoying HTML abuse.+filter{content-cookies} # Kill cookies that come in the HTML or JS content
+filter{content-cookies} # Kill cookies that come in the HTML or JS content.+filter{refresh-tags} # Kill automatic refresh tags (for dial-on-demand setups)
+filter{refresh-tags} # Kill automatic refresh tags (for dial-on-demand setups).+filter{unsolicited-popups} # Disable only unsolicited pop-up windows
+filter{unsolicited-popups} # Disable only unsolicited pop-up windows. Useful if your browser lacks this ability.+filter{all-popups} # Kill all popups in JavaScript and HTML
+filter{all-popups} # Kill all popups in JavaScript and HTML. Useful if your browser lacks this ability.+filter{img-reorder} # Reorder attributes in <img> tags to make the banners-by-* filters more effective
+filter{img-reorder} # Reorder attributes in <img> tags to make the banners-by-* filters more effective.+filter{banners-by-size} # Kill banners by size
+filter{banners-by-size} # Kill banners by size.+filter{banners-by-link} # Kill banners by their links to known clicktrackers
+filter{banners-by-link} # Kill banners by their links to known clicktrackers.+filter{webbugs} # Squish WebBugs (1x1 invisible GIFs used for user tracking)
+filter{webbugs} # Squish WebBugs (1x1 invisible GIFs used for user tracking).+filter{tiny-textforms} # Extend those tiny textareas up to 40x80 and kill the hard wrap
+filter{tiny-textforms} # Extend those tiny textareas up to 40x80 and kill the hard wrap.+filter{jumping-windows} # Prevent windows from resizing and moving themselves
+filter{jumping-windows} # Prevent windows from resizing and moving themselves.+filter{frameset-borders} # Give frames a border and make them resizable
+filter{frameset-borders} # Give frames a border and make them resizable.+filter{demoronizer} # Fix MS's non-standard use of standard charsets
+filter{demoronizer} # Fix MS's non-standard use of standard charsets.+filter{shockwave-flash} # Kill embedded Shockwave Flash objects
+filter{shockwave-flash} # Kill embedded Shockwave Flash objects.+filter{quicktime-kioskmode} # Make Quicktime movies saveable
+filter{quicktime-kioskmode} # Make Quicktime movies saveable.
+ +filter{crude-parental} # Crude parental filtering (demo only)
+filter{crude-parental} # Crude parental filtering. Note that this filter doesn't work reliably.
+filter{ie-exploits} # Disable some known Internet Explorer bug exploits. |
+filter{site-specifics} # Cure for site-specific problems. Don't apply generally! |
+filter{no-ping} # Removes non-standard ping attributes in <a> and <area> tags. |
+filter{google} # CSS-based block for Google text ads. Also removes a width limitation and the toolbar advertisement. |
+filter{yahoo} # CSS-based block for Yahoo text ads. Also removes a width limitation. |
+filter{msn} # CSS-based block for MSN text ads. Also removes tracking URLs and a width limitation. |
+filter{blogspot} # Cleans up some Blogspot blogs. Read the fine print before using this. |
Force Privoxy to treat a document as if it was in some kind of text format.
Declares a document as text, even if the "Content-Type:" isn't detected as such. +
Boolean.
N/A +
As explained above, + Privoxy tries to only filter files that are + in some kind of text format. The same restrictions apply to + content-type-overwrite. + force-text-mode declares a document as text, + without looking at the "Content-Type:" first. +
Warning |
Think twice before activating this action. Filtering binary data + with regular expressions can cause file damage. + |
+filter{ie-exploits} # Disable some known Internet Explorer bug exploits+force-text-mode + |
Force Privoxy to treat a document as if it was in some kind of text format.
Change the forwarding settings based on User-Agent or request originDeclares a document as text, even if the "Content-Type:" isn't detected as such. +> Overrules the forward directives in the configuration file.
Boolean.
Multi-value.N/A -
"forward ." to use a direct connection without any additional proxies.
"forward 127.0.0.1:8123" to use the HTTP proxy listening at 127.0.0.1 port 8123. +
"forward-socks4a 127.0.0.1:9050 ." to use the socks4a proxy listening at + 127.0.0.1 port 9050. Replace "forward-socks4a" with "forward-socks4" + to use a socks4 connection (with local DNS resolution) instead, use "forward-socks5" + for socks5 connections (with remote DNS resolution). +
"forward-socks4a 127.0.0.1:9050 proxy.example.org:8000" to use the socks4a proxy + listening at 127.0.0.1 port 9050 to reach the HTTP proxy listening at proxy.example.org port 8000. + Replace "forward-socks4a" with "forward-socks4" to use a socks4 connection + (with local DNS resolution) instead, use "forward-socks5" + for socks5 connections (with remote DNS resolution). +
As explained above, - Privoxy tries to only filter files that are - in some kind of text format. The same restrictions apply to - content-type-overwrite. - force-text-mode declares a document as text, - without looking at the "Content-Type:" first. +> This action takes parameters similar to the + forward directives in the configuration + file, but without the URL pattern. It can be used as replacement, but normally it's only + used in cases where matching based on the request URL isn't sufficient.
Think twice before activating this action. Filtering binary data - with regular expressions can cause file damage. +> Please read the description for the forward directives before + using this action. Forwarding to the wrong people will reduce your privacy and increase the + chances of man-in-the-middle attacks. +
If the ports are missing or invalid, default values will be used. This might change + in the future and you shouldn't rely on it. Otherwise incorrect syntax causes Privoxy + to exit. +
Use the show-url-info CGI page + to verify that your forward settings do what you thought the do.
+force-text-mode
+># Always use direct connections for requests previously tagged as
+# "User-Agent: fetch libfetch/2.0" and make sure
+# resuming downloads continues to work.
+# This way you can continue to use Tor for your normal browsing,
+# without overloading the Tor network with your FreeBSD ports updates
+# or downloads of bigger files like ISOs.
+# Note that HTTP headers are easy to fake and therefore their
+# values are as (un)trustworthy as your clients and users.
+{+forward-override{forward .} \
+ -hide-if-modified-since \
+ -overwrite-last-modified \
+}
+TAG:^User-Agent: fetch libfetch/2\.0$
The content type for the empty document can be specified with @@ -3622,7 +4604,7 @@ WIDTH="90%" CLASS="SCREEN" ># Block all documents on example.org that end with ".js", # but send an empty document instead of the usual HTML message. -{+block +handle-as-empty-document} +{+block{Blocked JavaScript} +handle-as-empty-document} example.org/.*\.js$ 8.5.15. handle-as-image8.5.19. handle-as-image
Mark URLs as belonging to images (so they'll be replaced by imagee Mark URLs as belonging to images (so they'll be replaced by images if they get blockedif they do get blocked)
, rather than HTML pages)This action will probably be removed in the future, + use server-header filters instead. +
# Disarm the download link in Sourceforge's patch tracker -{-filter\ -+content-type-overwrite {text/plain}\ -+hide-content-disposition {block} } -.sourceforge.net/tracker/download.php8.5.18. hide-if-modified-since8.5.22. hide-if-modified-since
Deletes the "If-Modified-Since:" HTTP client header or modifies its value. -
Parameterized.
Keyword: "block", or a user defined value that specifies a range of hours. -
Removing this header is useful for filter testing, where you want to force a real - reload instead of getting status code "304", which would cause the - browser to use a cached copy of the page. -
Instead of removing the header, hide-if-modified-since can - also add or substract a random amount of time to/from the headers value. - You specify a range of hours were the random factor should be chosen from and - Privoxy does the rest. A negative value means - subtracting, a positive value adding. -
Randomizing the value of the "If-Modified-Since:" makes - sure it isn't used as a cookie replacement, but you will run into - caching problems if the random range is too high. -
It is a good idea to only use a small negative value and let - overwrite-last-modified - handle the greater changes. -
It is also recommended to use this action together with - crunch-if-none-match. -
# Let the browser revalidate without being tracked across sessions -{+hide-if-modified-since {-1}\ -+overwrite-last-modified {randomize}\ -+crunch-if-none-match} -/ |
Improve privacy by hiding the true source of the request
Deletes any existing Deletes the "X-Forwarded-for:" HTTP header from client requests, - and prevents adding a new one. +>"If-Modified-Since:" HTTP client header or modifies its value.
Boolean.
Parameterized.N/A +> Keyword: "block", or a user defined value that specifies a range of hours.
It is fairly safe to leave this on. +> Removing this header is useful for filter testing, where you want to force a real + reload instead of getting status code "304", which would cause the + browser to use a cached copy of the page.
This action is scheduled for improvement: It should be able to generate forged +> Instead of removing the header, hide-if-modified-since can + also add or subtract a random amount of time to/from the header's value. + You specify a range of minutes where the random factor should be chosen from and Privoxy does the rest. A negative value means + subtracting, a positive value adding. +
Randomizing the value of the "X-Forwarded-for:" headers using random IP addresses from a specified network, - to make successive requests from the same client look like requests from a pool of different - users sharing the same proxy. +>"If-Modified-Since:" makes + it less likely that the server can use the time as a cookie replacement, + but you will run into caching problems if the random range is too high. +
It is a good idea to only use a small negative value and let + overwrite-last-modified + handle the greater changes. +
It is also recommended to use this action together with + crunch-if-none-match, + otherwise it's more or less pointless.
+hide-forwarded-for-headers# Let the browser revalidate but make tracking based on the time less likely. +{+hide-if-modified-since{-60} \ + +overwrite-last-modified{randomize} \ + +crunch-if-none-match} +/ |
"conditional-forge" to forge the header if the host has changed.
"block" to delete the header unconditionally.
Always blocking the referrer, or using a custom one, can lead to failures on servers that check the referrer before they answer any - requests, in an attempt to prevent their valuable content from being + requests, in an attempt to prevent their content from being embedded or linked to elsewhere.
8.5.22. hide-user-agent8.5.25. hide-user-agent
Conceal your type of browser and client operating system
Try to conceal your type of browser and client operating systemThis action is scheduled for improvement. -
+hide-user-agent{Netscape 6.1 (X11; I; Linux 2.4.18 i686)} |
To protect against the MS buffer over-run in JPEG processing
To protect against a known exploit -
Boolean.
N/A -
See Microsoft Security Bulletin MS04-028. JPEG images are one of the most - common image types found across the Internet. The exploit as described can - allow execution of code on the target system, giving an attacker access - to the system in question by merely planting an altered JPEG image, which - would have no obvious indications of what lurks inside. This action - prevents unwanted intrusion. -
+inspect-jpegs |
Eliminate those annoying pop-up windows (deprecated)
While loading the document, replace JavaScript code that opens - pop-up windows with (syntactically neutral) dummy code on the fly. -
Boolean.
N/A -
This action is basically a built-in, hardwired special-purpose filter - action, but there are important differences: For kill-popups, - the document need not be buffered, so it can be incrementally rendered while - downloading. But kill-popups doesn't catch as many pop-ups as - filter{all-popups} - does and is not as smart as filter{unsolicited-popups} - is. -
Think of it as a fast and efficient replacement for a filter that you - can use if you don't want any filtering at all. Note that it doesn't make - sense to combine it with any filter action, - since as soon as one filter applies, - the whole document needs to be buffered anyway, which destroys the advantage of - the kill-popups action over its filter equivalent. -
Killing all pop-ups unconditionally is problematic. Many shops and banks rely on - pop-ups to display forms, shopping carts etc, and the filter{unsolicited-popups} - does a fairly good job of catching only the unwanted ones. -
If the only kind of pop-ups that you want to kill are exit consoles (those - really nasty windows that appear when you close an other - one), you might want to use - filter{js-annoyances}Mozilla enter, yet forging to a + Netscape 6.1 user-agent works just fine. + (Must be just a silly MS goof, I'm sure :-). +
More information on known user-agent strings can be found at + http://www.user-agents.org/ - instead. + and + http://en.wikipedia.org/wiki/User_agent.
+kill-popups+hide-user-agent{Netscape 6.1 (X11; I; Linux 2.4.18 i686)} |
The CONNECT methods exists in HTTP to allow access to secure websites @@ -4934,25 +5613,18 @@ CLASS="QUOTE" > URLs) through proxies. It works very simply: the proxy connects to the server on the specified port, and then short-circuits its connections to the client and to the remote server. - This can be a big security hole, since CONNECT-enabled proxies can be - abused as TCP relays very easily. + This means CONNECT-enabled proxies can be used as TCP relays very easily.
Privoxy relays HTTPS traffic without seeing - the decoded content. Websites can leverage this limitation to circumvent Privoxy's + the decoded content. Websites can leverage this limitation to circumvent Privoxy's filters. By specifying an invalid port range you can disable HTTPS entirely. - If you plan to disable SSL by default, consider enabling - treat-forbidden-connects-like-blocks - as well, to be able to quickly create exceptions.
+limit-connect{443} # This is the default and need not be specified. +>+limit-connect{443} # Port 443 is OK. +limit-connect{80,443} # Ports 80 and 443 are OK. +limit-connect{-3, 7, 20-100, 500-} # Ports less than 3, 7, 20 to 100 and above 500 are OK. +limit-connect{-} # All ports are OK -+limit-connect{,} # No HTTPS traffic is allowed
More and more websites send their content compressed by default, which
- is generally a good idea and saves bandwidth. But for the filter, and
+ deanimate-gifs
- and kill-popups actions to work,
- When compiled with zlib support (available since Privoxy needs access to the uncompressed data.
- Unfortunately, 3.0.7), content that should be
+ filtered is decompressed on-the-fly and you don't have to worry about this action.
+ If you are using an older Privoxy can't yet(!) uncompress, filter, and
- re-compress the content on the fly. So if you want to ensure that all websites, including
- those that normally compress, can be filtered, you need to use this action.
+> version, or one that hasn't been compiled with zlib
+ support, this action can be used to convince the server to send the content uncompressed.
This will slow down transfers from those websites, though. If you use any of the above-mentioned
- actions, you will typically want to use prevent-compression in conjunction
- with them.
+> Most text-based instances compress very well, the size is seldom decreased by less than 50%,
+ for markup-heavy instances like news feeds saving more than 90% of the original size isn't
+ unusual.
+ Not using compression will therefore slow down the transfer, and you should only
+ enable this action if you really need it. As of Privoxy 3.0.7 it's disabled in all
+ predefined action settings.
Note that some (rare) ill-configured sites don't handle requests for uncompressed
- documents correctly (they send an empty document body). If you use prevent-compression
- per default, you'll have to add exceptions for those sites. See the example for how to do that.
+> per default, you might want to add
+ exceptions for those sites. See the example for how to do that.
# Set default: +># Selectively turn off compression, and enable a filter +# +{ +filter{tiny-textforms} +prevent-compression } +# Match only these sites + .google. + sourceforge.net + sf.net + +# Or instead, we could set a universal default: # -{+prevent-compression} -/ # Match all sites +{ +prevent-compression } + / # Match all sites -# Make exceptions for ill sites: +# Then maybe make exceptions for broken sites: # -{-prevent-compression} -www.debianhelp.org -www.pclinuxonline.com
# Let the browser revalidate without being tracked across sessions -{+hide-if-modified-since {-1}\ -+overwrite-last-modified {randomize}\ -+crunch-if-none-match} +{ +hide-if-modified-since{-60} \ + +overwrite-last-modified{randomize} \ + +crunch-if-none-match} /8.5.28. redirect8.5.29. redirect
Any URL. +> An absolute URL or a single pcrs command.
This action is useful to replace whole documents with your own - ones. For that to work, they have to be available on another server. +> Requests to which this action applies are answered with a + HTTP redirect to URLs of your choosing. The new URL is + either provided as parameter, or derived by applying a + single pcrs command to the original URL.
You can do the same by combining the actions +> This action will be ignored if you use it together with block, - handle-as-image and +>. + It can be combined with set-image-blocker{URL}fast-redirects{check-decoded-url}. - It doesn't sound right for non-image documents, and that's why this action - was created. +> + to redirect to a decoded version of a rewritten URL.
This action will be ignored if you use it together with - block Use this action carefully, make sure not to create redirection loops + and be aware that using your own redirects might make it + possible to fingerprint your requests. +
In case of problems with your redirects, or simply to watch + them working, enable debug 128.
Feed log analysis scripts with useless data. +> Rewrite or remove single server headers.
Sends a cookie with each request stating that you do not accept any copyright - on cookies sent to you, and asking the site operator not to track you. +> All server headers to which this action applies are filtered on-the-fly + through the specified regular expression based substitutions.
Boolean.
Parameterized.N/A +> The name of a server-header filter, as defined in one of the + filter files.
The vanilla wafer is a (relatively) unique header and could conceivably be used to track you. +> Server-header filters are applied to each header on its own, not to + all at once. This makes it easier to diagnose problems, but on the downside + you can't write filters that only change header x if header y's value is z. + You can do that by using tags though.
This action is rarely used and not enabled in the default configuration. +> Server-header filters are executed after the other header actions have finished + and use their output as input. +
Please refer to the filter file chapter + to learn which server-header filters are available by default, and how to + create your own.
+send-vanilla-wafer{+server-header-filter{html-to-xml}} +example.org/xml-instance-that-is-delivered-as-html + +{+server-header-filter{xml-to-html}} +example.org/instance-that-is-delivered-as-xml-but-is-not + |
Send custom cookies or feed log analysis scripts with even more useless data. +> Enable or disable filters based on the Content-Type header.
Sends a custom, user-defined cookie with each request. +> Server headers to which this action applies are filtered on-the-fly through + the specified regular expression based substitutions, the result is used as + tag.
Multi-value.
Parameterized.A string of the form "name=value" The name of a server-header tagger, as defined in one of the + filter files.
Being multi-valued, multiple instances of this action can apply to the same request, - resulting in multiple cookies being sent. +> Server-header taggers are applied to each header on its own, + and as the header isn't modified, each tagger "sees" + the original. +
Server-header taggers are executed before all other header actions + that modify server headers. Their tags can be used to control + all of the other server-header actions, the content filters + and the crunch actions (redirect + and block).
This action is rarely used and not enabled in the default configuration. +> Obviously crunching based on tags created by server-header taggers + doesn't prevent the request from showing up in the server's log file.
{+send-wafer{UsingPrivoxy=true}} -my-internal-testing-server.void# Tag every request with the content type declared by the server +{+server-header-tagger{content-type}} +/ + |
Redirect to the BSD devil: +> Redirect to the BSD daemon:
+treat-forbidden-connects-like-blocks |
Note that many of these actions have the potential to cause a page to misbehave, possibly even not to display at all. There are many ways @@ -6119,8 +6739,8 @@ CLASS="SECT2" CLASS="SECT2" >8.6. Aliases8.6. Aliases
Custom Privoxy.
Now let's define some aliases...
crunch-outgoing-cookies - block-as-image = +block +handle-as-image - mercy-for-cookies = -crunch-all-cookies -session-cookies-only -hide-referrer -kill-popupsprevent-compression + shop = -crunch-all-cookies -filter{all-popups} -kill-popups # Short names for other aliases, for really lazy people ;-) @@ -6328,7 +6942,8 @@ CLASS="SCREEN" {fragile} .office.microsoft.com .windowsupdate.microsoft.com - .nytimes.com + # Gmail is really mail.google.com, not gmail.com + mail.google.com # Shopping sites: # Allow cookies (for setting and retrieving your customer data) @@ -6336,11 +6951,11 @@ CLASS="SCREEN" {shop} .quietpc.com .worldpay.com # for quietpc.com - .scan.co.uk + mybank.example.com # These shops require pop-ups: # - {shop -kill-popups -filter{all-popups}} + {-filter{all-popups} -filter{unsolicited-popups}} .dabs.com .overclockers.co.uk and "fragile" are often used for +> are typically used for "problem" sites that require some actions to be disabled +> sites that require more than one action to be disabled in order to function properly.
The above chapters have shown . Now, let's look at an example match-all.action, default.action + and user.action file and see how all these pieces come together:
Remember all actions are disabled when matching starts, + so we have to explicitly enable the ones we want.
While the match-all.action file only contains a + single section, it is probably the most important one. It has only one + pattern, "/", but this pattern + matches all URLs. Therefore, the set of + actions used in this "default" section will + be applied to all requests as a start. It can be partly or + wholly overridden by other actions files like default.action and + and user.action - file and see how all these pieces come together:
Every config file should start with a short comment stating its purpose:
Again, at the start of matching, all actions are disabled, so there is + no need to disable any actions here. (Remember: a "+" + preceding the action name enables the action, a "-" disables!). + Also note how this long line has been made more readable by splitting it into + multiple lines with line continuation.
# Sample default.action file <ijbswa-developers@lists.sourceforge.net>{ \ + +change-x-forwarded-for{block} \ + +hide-from-header{block} \ + +set-image-blocker{pattern} \ +} +/ # Match all URLs + |
Then, since this is the The default behavior is now set.
If you aren't a developer, there's no need for you to edit the + default.action file. It is maintained by + the Privoxy developers and if you disagree with some of the + sections, you should overrule them in your user.action.
Understanding the default.action file, the -first section is a special section for internal use that you needn't -change or worry about:
file can + help you with your user.action, though.The first section in this file is a special section for internal use + that prevents older Privoxy versions from reading the file:
After that comes the (optional) alias section. We'll use the example -section from the above After that comes the (optional) alias section. We'll use the example + section from the above chapter on aliases, -that also explains why and how aliases are used:
Now come the regular sections, i.e. sets of actions, accompanied - by URL patterns to which they apply. Remember all actions - are disabled when matching starts, so we have to explicitly - enable the ones we want.
The first regular section is probably the most important. It has only - one pattern, "/", but this pattern - matches all URLs. Therefore, the - set of actions used in this "default" section will - be applied to all requests as a start. It can be partly or - wholly overridden by later matches further down this file, or in user.action, - but it will still be largely responsible for your overall browsing - experience.
Again, at the start of matching, all actions are disabled, so there is - no real need to disable any actions here, but we will do that nonetheless, - to have a complete listing for your reference. (Remember: a "+" - preceding the action name enables the action, a "-" disables!). - Also note how this long line has been made more readable by splitting it into - multiple lines with line continuation.
The default behavior is now set. Note that some actions, like not hiding - the user agent, are part of a "general policy" that applies - universally and won't get any exceptions defined later. Other choices, - like not blocking (which is understandably the - default!) need exceptions, i.e. we need to specify explicitly what we - want to block in later sections.
The first of our specialized sections is concerned with "fragile"
You wouldn't believe how many advertisers actually call their banner +> It's quite remarkable how many advertisers actually call their banner servers ads. } adv[io]*. # (for advogato.org and advice.*) adsl. # (has nothing to do with ads) +adobe. # (has nothing to do with ads either) ad[ud]*. # (adult.* and add.*) .edu # (universities don't host banners (yet!)) .*loads. # (downloads, uploads etc) @@ -7227,7 +7698,10 @@ CLASS="SCREEN" HREF="actions-file.html#FILTER" >filter } -/.*cvs +/(.*/)?cvs +bugzilla. +developer. +wiki. .sourceforge.net The actual default.action is of course more +> is of course much more comprehensive, but we hope this example made clear how it works.
Say you have accounts on some sites that you visit regularly, and you don't want to have to log in manually each time. So you'd like @@ -7368,12 +7856,10 @@ WIDTH="100%" >
{ allow-all-cookies } -sourceforge.net -sunsolve.sun.com -.slashdot.org -.yahoo.com -.msdn.microsoft.com -.redhat.comfilter } -.your-home-banking-site.com{ +block }{ +block{} } section. Note that { +handle-as-image @@ -7459,9 +7945,9 @@ CLASS="SCREEN" >{ +block } -www.example.com/nasty-ads/sponsor.gif -another.popular.site.net/more/junk/here/{Nasty ads.} } + www.example.com/nasty-ads/sponsor\.gif + another.example.net/more/junk/here/
{ +block-as-image } -.doubleclick.net -/Realmedia/ads/ -ar.atwola.com/Privoxy - that is causing the problem or not.
{ allow-ads } -.sourceforge.net -.slashdot.org -.osdn.netabove.
Invoke another alias here to force an over-ride of the MIME type application/x-sh which typically would open a download type + dialog. In my case, I want to look at the shell script, and then I can save + it should I choose to.
{ handle-as-text } + /.*\.sh$ |
user.action