Testing SSL (LetsEncrypt certificate and loopback domain)
This sets up a publically-available domain that loops back to localhost IP address
127.0.0.1. For example, this address could be
localhost.example.com if we controlled the
example.com domain. This relies on having a public domain name whose DNS records you can control. We can then generate LetsEncrypt certificates for this domain.
Our HTTP server runs on
localhost:80 (default HTTP port). This lets us visit
http://localhost.example.com in a web browser and see the server running on
We then run an HTTPS proxy server on
localhost:443 (default HTTPS port) that uses the LetsEncrypt certificates we generated for
https://localhost.example.com hits the proxy, which returns the correct certificates meaning the browser displays the "Secure" message. The proxy then passes the request through to the HTTP server.