Post Reply 
Redirect http to https of the same domain.
Aug. 12, 2018, 11:36 AM
Post: #1
Redirect http to https of the same domain.
Hello! Here's a filter that does not work:
Code:
{ +redirect{s@^http://@https://@} }

.example.com

More precisely, the browser says that "incorrect redirection on the page." In the console, you can see that the redirect happens several times on the same page. I sort of understand the problem, I got some kind of fixated redirect, but I do not understand how to solve it. Using rewrite and the client-header-filter in. From help's Privoxy I do not really understand how to do it.
Add Thank You Quote this message in a reply
Mar. 17, 2019, 08:26 PM (This post was last modified: Mar. 17, 2019 08:30 PM by vlad_s.)
Post: #2
RE: Redirect http to https of the same domain.
Due to the operation of ProxHTTPSProxyMII, the redirects action cannot be performed. It turns out an endless redirect. For example http://example.com to https://example.com. If you redirect to another site, then there is no problem, http://example.com to https://example2.com. How can you solve this problem? You can try to make filters for Privoxy, but I acted differently. On top of that, I use a squid proxy server, he also knows how to redirect. Add the following lines to its config:
Code:
acl PORT80 localport 80
acl MYSITE dstdomain "/etc/squid/redirect"
http_access deny PORT80 MYSITE
deny_info 301:https://%H%R MYSITE
Create a redirect file at the specified path and fill in the necessary sites, one line - one site. Perform "squid -k reconfigure". We use. Thanks Smile!.
Add Thank You Quote this message in a reply
Mar. 19, 2019, 03:34 AM
Post: #3
RE: Redirect http to https of the same domain.
ProxHTTPSProxyMII's front server adds the request header
Code:
Tagged:ProxHTTPSProxyMII FrontProxy/
.
So "Tagged" requests are HTTPS requests.

To avoid the loop, Privoxy must not redirect request that contain the "Tagged" header.

At https://www.privoxy.org/user-manual/actions-file.html , I see

Quote:8.4.4. The Negative Request Tag Patterns
To match requests that do not have a certain request tag, specify a negative tag pattern by prefixing the tag pattern line with either "NO-REQUEST-TAG:" or "NO-RESPONSE-TAG:" instead of "TAG:".

Negative request tag patterns created with "NO-REQUEST-TAG:" are checked after all client headers are scanned, the ones created with "NO-RESPONSE-TAG:" are checked after all server headers are scanned. In both cases all the created tags are considered.

I would try adding a "NO-REQUEST-TAG:" command for Tagged:ProxHTTPSProxyMII FrontProxy/ to the filter.

I will leave the syntax to others.

HTH
Add Thank You Quote this message in a reply
[-] The following 1 user says Thank You to JJoe for this post:
vlad_s
Mar. 19, 2019, 08:42 PM
Post: #4
RE: Redirect http to https of the same domain.
Not quite clear how to do this? Filters sequence and actions?
Add Thank You Quote this message in a reply
Mar. 21, 2019, 03:35 AM
Post: #5
RE: Redirect http to https of the same domain.
(Mar. 19, 2019 08:42 PM)vlad_s Wrote:  Not quite clear how to do this?

Me too. You have been warned. Wink

After installing Privoxy 3.0.28, I added

Code:
{ +redirect{s@^http://prxbx.com@https://prxbx.com@} }
NO-REQUEST-TAG:.*?Tagged

to the end of user.action.

I think it works? There is no loop and Privoxy's log showed:

Quote:2019-03-20 20:59:10.546 00002cd8 Header: scan: GET http://prxbx.com/download/ HTTP/1.1
2019-03-20 20:59:10.546 00002cd8 Header: scan: Host: prxbx.com
2019-03-20 20:59:10.546 00002cd8 Header: scan: User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0
2019-03-20 20:59:10.546 00002cd8 Header: scan: Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
2019-03-20 20:59:10.546 00002cd8 Header: scan: Accept-Language: en-US,en;q=0.5
2019-03-20 20:59:10.546 00002cd8 Header: scan: Accept-Encoding: gzip, deflate
2019-03-20 20:59:10.562 00002cd8 Header: scan: DNT: 1
2019-03-20 20:59:10.562 00002cd8 Header: scan: Connection: keep-alive
2019-03-20 20:59:10.562 00002cd8 Header: scan: Upgrade-Insecure-Requests: 1
2019-03-20 20:59:10.578 00002cd8 Header: Updated action bits based on: NO-REQUEST-TAG:.*?Tagged
2019-03-20 20:59:10.578 00002cd8 Header: Keeping the client header 'Connection: keep-alive' around. The server connection will be kept alive if possible.
2019-03-20 20:59:10.578 00002cd8 Header: New HTTP Request-Line: GET /download/ HTTP/1.1
2019-03-20 20:59:10.578 00002cd8 Redirect: pcrs command "s@^http://prxbx.com@https://prxbx.com@" changed "http://prxbx.com/download/" to "https://prxbx.com/download/" (1 hit).
2019-03-20 20:59:10.593 00002cd8 Redirect: New URL is: https://prxbx.com/download/

2019-03-20 20:59:11.656 00001f70 Header: scan: GET http://prxbx.com/download/ HTTP/1.1
2019-03-20 20:59:11.656 00001f70 Header: scan: Tagged: ProxHTTPSProxyMII FrontProxy/v1.5 Python/3.4.4:609
2019-03-20 20:59:11.672 00001f70 Header: Tagger 'tagger4https' added tag 'Tagged: ProxHTTPSProxyMII FrontProxy/v1.5 Python/3.4.4:609'. Action bits updated accordingly.


Code:
{ +redirect{s@^http://@https://@} }
NO-REQUEST-TAG:.*?Tagged

also works for me but will redirect sites that don't support https.

Quote:2019-03-20 22:15:04.198 00002118 Header: scan: GET http://prxbx.com/download/ HTTP/1.1
2019-03-20 22:15:04.198 00002118 Header: scan: Host: prxbx.com
2019-03-20 22:15:04.198 00002118 Header: scan: User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0
2019-03-20 22:15:04.198 00002118 Header: scan: Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
2019-03-20 22:15:04.214 00002118 Header: scan: Accept-Language: en-US,en;q=0.5
2019-03-20 22:15:04.214 00002118 Header: scan: Accept-Encoding: gzip, deflate
2019-03-20 22:15:04.214 00002118 Header: scan: DNT: 1
2019-03-20 22:15:04.214 00002118 Header: scan: Connection: keep-alive
2019-03-20 22:15:04.214 00002118 Header: scan: Upgrade-Insecure-Requests: 1
2019-03-20 22:15:04.214 00002118 Header: Updated action bits based on: NO-REQUEST-TAG:Tagged
2019-03-20 22:15:04.230 00002118 Header: Keeping the client header 'Connection: keep-alive' around. The server connection will be kept alive if possible.
2019-03-20 22:15:04.230 00002118 Header: New HTTP Request-Line: GET /download/ HTTP/1.1
2019-03-20 22:15:04.230 00002118 Redirect: pcrs command "s@^http://@https://@" changed "http://prxbx.com/download/" to "https://prxbx.com/download/" (1 hit).
2019-03-20 22:15:04.230 00002118 Redirect: New URL is: https://prxbx.com/download/

2019-03-20 22:15:05.292 000025c0 Header: scan: GET http://prxbx.com/download/ HTTP/1.1
2019-03-20 22:15:05.292 000025c0 Header: scan: Tagged: ProxHTTPSProxyMII FrontProxy/v1.5 Python/3.4.4:650
2019-03-20 22:15:05.308 000025c0 Header: Tagger 'tagger4https' added tag 'Tagged: ProxHTTPSProxyMII FrontProxy/v1.5 Python/3.4.4:650'. Action bits updated accordingly.

HTH
Add Thank You Quote this message in a reply
Mar. 25, 2019, 04:47 PM
Post: #6
RE: Redirect http to https of the same domain.
Yes, it works, but in my example only with sites specified in the file /etc/squid/redirect, i.e. better selectively.
Add Thank You Quote this message in a reply
Jun. 08, 2019, 07:58 PM
Post: #7
RE: Redirect http to https of the same domain.
The construction doesn't really work, example:
Code:
{ +redirect{s@^http://nnmclub.to@https://nnmclub.to@} }
NO-REQUEST-TAG:.*?Tagged
nnmclub.to/
Privoxy log:
Code:
2019-06-08 22:53:39.193 7fa0e2ffd700 Redirect: pcrs command "s@^http://nnmclub.to@https://nnmclub.to@" didn't change "http://bt4.rutracker.cc/ann?pk=xxx".
Or I do not understand something.
Add Thank You Quote this message in a reply
Post Reply 


Forum Jump: