# [solved] redirect http to https for known sites

## avx

I'd like to know, if there's a way to redirect some sites - based on a self-made list- from http to https, if possible with privoxy.

So, let's say I know that the http://domain.com is also available as https://domain.com, but a) I don't want to clutter my bookmarks and b) I want any link going from http://example.com to http://domain.com/file.txt to https://domain.com/file.txt

To make it clear, this is not meant for my server, it's meant for server of other people.

There's a nice addon for firefox and I already requested something like this in the opera-forums, but it would be nice to have this functionality for every client.

input,input(please)  :Smile: Last edited by avx on Wed Oct 21, 2009 8:30 am; edited 1 time in total

----------

## poly_poly-man

transparent proxy plus clever scripting to add the s?

----------

## think4urs11

This can be problematic with sites where some elements are only available via http.

----------

## avx

 *Quote:*   

> This can be problematic with sites where some elements are only available via http

 That's true, but if that happens, one could still load the http-only version after a "failed" https-attempt("Vorsorge..."  :Wink:  )

 *Quote:*   

> transparent proxy plus clever scripting to add the s?

 I guess this is possible and maybe not so hard to do, but I don't have any experience with such proxies(good starting points?) and I guess this wouldn't scale very well.

----------

## think4urs11

 *ph030 wrote:*   

>  *Quote:*   This can be problematic with sites where some elements are only available via http That's true, but if that happens, one could still load the http-only version after a "failed" https-attempt("Vorsorge..."  )

 

How do you do that when you have an instance in your network in place which prevents the http-access in first place? Catch-22  :Wink: 

What you can do generally is to implement squid plus a little redirector like

```
#!/usr/local/bin/perl

$|=1;

while (<>)

   {

   s@http://mail.google.com@https://mail.google.com@;

   print;

   }
```

more infos: http://wiki.squid-cache.org/Features/Redirectors

----------

## avx

 *Quote:*   

> How do you do that when you have an instance in your network in place which prevents the http-access in first place? Catch-22 

 You mean that when I issue domain.bla by hand, that the proxy intercepts? Well, I'm not going to force the proxy or did you mean something else?

Squid would be an option, I'm looking into that the next days. Currently I've got polipo as cache and filter, but iirc there are some filtering addons for squid(if yes, how "good" are they compared to i.e. adblockplus or privoxy?)?!

----------

## think4urs11

 *ph030 wrote:*   

>  I want any link going from  http://domain.com/file.txt to https://domain.com/file.txt

  *ph030 wrote:*   

> I'm not going to force the proxy or did you mean something else?

 

Huh? Ok, when you don't enforce the proxy usage you can go around the redirect by disabling the proxy on the client and go out directly but that's not exactly comfortable.

I'm not too much expirienced with privoxy but it might be possible with it too.

A good universal blocklist is http://urlblacklist.com/ - not yet compared against adblock+ though.

----------

## avx

The wanted solution is only for our private needs at home, so it's mainly about me/wifey being too lazy to always enter the https-part by hand and still do something for security. Of course, this ain't perfect, but it's another step in the imho right direction.

Thanks for the link, but do I see it right, I need a payed subscription to make use of it?

----------

## think4urs11

hmm, why don't you simply use bookmarks then?  :Wink: 

 *Quote:*   

> You can try the service by downloading the blacklist once for free. 

 

Annother (ad-servers only) list is e.g. here: http://hostsfile.mine.nu/

----------

## avx

 *Quote:*   

> hmm, why don't you simply use bookmarks then?

 How shall bookmarking work? A simple example, espacially for you, since I guess you know both sites: blog.fefe.de & lawblog.de, both are available with and without https and yeah, I've got both bookmarked. They don't link via https between them, so if I read fefe and find something interesting on lawblog, I click and come out as http...how am I supposed to bookmark things I don't know yet and even harder, how am I supposed to handle X links as bookmarks?

----------

## think4urs11

point taken  :Wink: 

In that case a redirector is the only choice, but as already explained to 'disable' it you'd need to change the proxy settings on demand.

----------

## avx

Disable on  demand ain't a big problem, either pressing F12->R do deactive the proxy or I can just add urls to opera's "don't use proxy for that url"-list.

----------

## avx

Bump, any other solutions out there?

----------

## avx

Solved and imho easier than I thought it would be. Finally I've found enough time to dig through privoxy's config and the following placed in 'user.action' works for me: 

```
{ +redirect{s@http://@https://@} }

forums.gentoo.org

amazon.de
```

----------

