Forward proxy
It turned out that configuring my own forward HTTP proxy was actually really simple! Here's how I did it. First, I placed the following nginx configuration file in /etc/nginx/sites-enabled/
:
server {
listen 81;
location / {
resolver 8.8.8.8;
proxy_http_version 1.1;
# Uncomment this if SNI support is required
# proxy_ssl_server_name on;
proxy_pass https://$host$request_uri;
}
}
As per the comment, you may find that Server Name Indication support is required, but not always. See https://stackoverflow.com/a/38401715/5924962 for more information
Then, on the Window 95 machine, I opened Netscape Communicator and went to Edit -> Preferences -> Advanced -> Proxies -> Manual Proxy Configuration
and entered the following information:
(Note that 192.168.178.129
is the IP address of the machine that is running nginx in my case.)
That's it! Netscape Communicator now happily connects to any HTTPS website. As proof, here is a screenshot of this very question, as rendered by this 25 year old web browser:
Rewrite links in the document
A problem is that links in the document will still likely point to HTTPS targets and will bypass the proxy. The ngx_http_sub module can be used to rewrite some or most of the links in the document:
proxy_set_header Accept-Encoding "";
sub_filter_once off;
sub_filter_last_modified on;
sub_filter '<a href="https:' '<a href="http:';
sub_filter '<img src="https:' '<img src="http:';
gzip_proxied any;
gzip_http_version 1.0;
gzip_comp_level 7;
The http_sub module will only work on text/html
by default, and can not operate on compressed data so compression is disabled by modifying the Accept-Encoding
header. Compression can then be turned back on to the client using the gzip_…
directives.
The built-in substitution can only do exact strings so it will not catch all links. There is a regex-capable module available for the ambitious.