How to make SSH port fowarding for HTTPS?

Let´s suppose that example.com is 93.184.216.34.

One of the methods could be as follows.

Do:

ssh -L 4433:93.184.216.34:443 remote-linux-host

Define in your local /etc/hosts in the machine using the browser:

127.0.0.1 example.com

And then open in the browser: https://example.com:4433/

In this way, it will send the correct Host header.

Beware of browser/resolver DNS caches after creating the hosts entry.


To keep hostnames, SSL certs, etc. all happy, you could use the -D option to create a dynamic SOCKS4/5 proxy.

ssh -D 4444 username@ssh-hostname

Then on local machine set firefox/chrome to use said proxy.