[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: set privoxy to rewrite http to https



On Sat, Jan 01, 2011 at 03:46:09AM -0800, S Mathias wrote:
[...]
> The problem is: e.g.: facebook...
> 
> if i go to 
> https://www.facebook.com/
> 
> that's ok, it's https.
> But all the links are "http" on the site..
> if i click on a "http" link, it will request the page on "http", and THEN
> it switches to "https". Heres the problem. 
> 
> How/where could i write a privoxy rule, to rewrite all the "http" links
> to "https"? [so that it would by always trully over https]
[...]

Here's how you would do it with a filter in Privoxy, but it won't actually
work. I'll explain below, and give a better solution. This would go in a
.filter file in /etc/privoxy/ (probably user.filter):

FILTER: https_dammit Make explicit http links into https links
s/href="http:/href="https:/g

Now, in some .action file (probably user.action):

{ +filter{https_dammit} }
.facebook.com

You can add as many domains, one per line, below .facebook.com as you like.
This will modify, on the fly, the HTML you receive from the domains listed.
It won't work, however, because if you are requesting the HTML via HTTPS
then it isn't passing through Privoxy at all. Privoxy isn't an HTTPS proxy,
just an HTTP proxy (it will pass a connection to an HTTPS server, but it
will not actually do SSL).

Instead, you can set up Privoxy to respond to requests to a particular
domain with a 301 (or 302, I forget) response and the https:// version of
the URL. This may or may not cause trouble with POST requests, so you may
have to add likely POST paths to an action turning off the redirect (this
goes in user.action):

{ +redirect{s@http://@https://@} }
.facebook.com

( -redirect }
www.facebook.com/some/post/path

Note that none of this is tested, so you may have to play with it a bit to
get it working.

> thank you for any information
> Happy New Year!
--Greg


Reply to: