[Privoxy-users] rewriting the Host header, switching protocols
Madhu
enometh at meer.net
Thu Jun 15 14:47:55 CEST 2023
Hello, [Thank you for your quick reply]
* Fabian Keil <20230323085448.56008ae0 at fabiankeil.de>
Wrote on Thu, 23 Mar 2023 08:54:48 +0100
> Madhu <enometh at meer.net> wrote on 2023-03-23 at 09:55:27:
>> 1. To rewrite the Host: header of a forwarded request to a target
>> webserver (based on certain criteria)
> This is supported and can be done with a client-header filter:
> https://www.privoxy.org/user-manual/actions-file.html#CLIENT-HEADER-FILTER
>
> You can use tags or URL patterns to decide when to apply the filter.
Thanks. I was able to get this working easily with the excellent
documentation.
>> 2. To switch the protocol from HTTPS to HTTP when forwarding a request
>> to another proxy (typically local, again based on certain criteria)
>
> This can be done by rewriting the protocol in the URL
> in the request line with a client-header filter.
Since the host isn't available in the client-header-filter I figure
this means that there has to be as many client filters as there are
hosts involved. This is not really a problem.
I think I have a problem if I want to chain a forwarding action after
the downgrade to http - with a user actions file section like this:
```
{ +client-header-filter{downgrade-http-on-wwwhost} \
+forward-override{ forward <http-proxyhost>:<http-proxyport> } }
wwwhost/
```
called by a `curl -v -x localhost:8118 https://<wwwwhost>' request
privoxy initially scans a "CONNECT <wwwhost>:443 HTTP/1.1" line from
curl, correctly applies the client header filters, detects the
rewritten header and the http downgrade, and rewrites the request
lines, but the new HTTP request line to send to the forwarding proxy
is "CONNECT <wwwhost>:80 HTTP/1.1" to establish a proxy tunnel but
since the protocol is now http I'd like it to be "GET http://<wwwhost>
HTTP/1.1"
Does this need a new sort of forwarding action?
---Best Regards, Madhu
(if the browser cannot be forced to redirect from https to http)
More information about the Privoxy-users
mailing list