[Privoxy-users] Prevent Privoxy from Filtering Localhost

Fabian Keil fk at fabiankeil.de
Tue Jan 3 14:38:06 UTC 2017


Vanderdenduur <rvrnt at icloud.com> wrote:

> Hello,
> I created a rule to redirect common JS requests to the local versions 
> installed in a folder called CommonJS.
> Here’s the ruleset:
> 
> |# { 
> +redirect{s@^(https?://)?(?!localhost)[^,%]*(?!/CommonJS/)\b(angular|backbone|dojo|ember|ext-core|jquery.ui(.min)?|jquery.min|modernizr.min|mootools-yui-compressed|prototype|scriptaculous|swfobject|underscore-min)\b[^/]*\.js[^,%]*@http://localhost/~Nathalie/CommonJS/$2.js@} 
> } # github.com/Synzvato/decentraleyes/tree/master/data/resources 
> /[^,%]*(?!/CommonJS/)\b(angular|backbone|dojo|ember|ext-core|jquery.ui(.min)?|jquery.min|modernizr.min|mootools-yui-compressed|prototype|scriptaculous|swfobject|underscore-min)\b[^/]*\.js[^,%]* 
> |
> 
> I tried to make it simpler…
> Unfortunately, at some point, Privoxy attempts to re-analyse the local 
> version too, which I don’t want.
> Here’s the log version:
> 
> |2016-12-31 11:08:45.163 00000128 Redirect: pcrs command 
> "s@^(https?://)?(?!localhost)[^,%]*(?!/CommonJS/)\b(angular|backbone|dojo|ember|ext-core|jquery.ui(.min)?|jquery.min|modernizr.min|mootools-yui-compressed|prototype|scriptaculous|swfobject|underscore-min)\b[^/]*\.js[^,%]*@http://localhost/~Nathalie/CommonJS/$2.js@" 
> changed 
> "http://www.some_site/scripts/jquery-ui-1.11.0.custom/jquery-ui.min.js" 
> to "http://localhost/~Nathalie/CommonJS/jquery-ui.min.js" (1 hit). 
> 2016-12-31 11:08:45.163 00000128 Redirect: New URL is: 
> http://localhost/~Nathalie/CommonJS/jquery-ui.min.js 2016-12-31 
> 11:08:45.163 00000128 Crunch: Redirected: 
> http://www.some_site/scripts/jquery-ui-1.11.0.custom/jquery-ui.min.js 
> 127.0.0.1 - - [31/Dec/2016:11:08:45 +0000] "GET 
> http://www.some_site/scripts/jquery-ui-1.11.0.custom/jquery-ui.min.js 
> HTTP/1.1" 302 0 2016-12-31 11:08:45.237 000000b0 Redirect: pcrs command 
> "s@^(https?://)?(?!localhost)[^,%]*(?!/CommonJS/)\b(angular|backbone|dojo|ember|ext-core|jquery.ui(.min)?|jquery.min|modernizr.min|mootools-yui-compressed|prototype|scriptaculous|swfobject|underscore-min)\b[^/]*\.js[^,%]*@http://localhost/~Nathalie/CommonJS/$2.js@" 
> changed "http://localhost/~Nathalie/CommonJS/jquery-ui.min.js" to 
> "http://localhost/~Nathalie/CommonJS/jquery-ui.min.js" (1 hit). 
> 2016-12-31 11:08:45.237 000000b0 Error: New URL 
> "http://localhost/~Nathalie/CommonJS/jquery-ui.min.js" and old URL 
> "http://localhost/~Nathalie/CommonJS/jquery-ui.min.js" are the same. 
> Redirection loop prevented. 2016-12-31 11:08:45.237 000000b0 Request: 
> localhost/~Nathalie/CommonJS/jquery-ui.min.js |
> 
> In particular, I see (from above)
> 
> |2016-12-31 11:08:45.237 000000b0 Error: New URL 
> "http://localhost/~Nathalie/CommonJS/jquery-ui.min.js" and old URL 
> "http://localhost/~Nathalie/CommonJS/jquery-ui.min.js" are the same. 
> Redirection loop prevented. |
> 
> Is there a way to not allow Privoxy analyse data hosted on localhost? I 
> have put |localhost| in { -filter } and have inserted the 
> |(?!localhost)| in the ruleset to prevent Privoxy from analysing 
> localhost request, but with no effect.
> Afterwards, when this “error” occurs, Privoxy goes crazy cruising at 
> full CPU.

The filter{} and the redirect{} action don't depend on each other.

Using "-filter" will disable content filtering, but if you want
to prevent redirects you need "-redirect".

Once you disable the redirect action for localhost you no longer
need the "(?!localhost)" in the pcrs command used by the +redirect{}
action and probably can remove the "(?!/CommonJS/)" as well.
Removing them will make the pcrs command more efficient and should
reduce the CPU usage.

After you updated your configuration you can check the final results at:
http://config.privoxy.org/show-url-info?url=http%3A%2F%2Flocalhost%2F~Nathalie%2FCommonJS%2Fjquery-ui.min.js
to confirm that it contains "-redirect".

The "Redirection loop prevented." message indicates a misconfiguration.
Privoxy is only able to detect obvious redirection loops and it's
recommended not to rely on this.

Fabian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.privoxy.org/pipermail/privoxy-users/attachments/20170103/0a2c4626/attachment.bin>


More information about the Privoxy-users mailing list