SOCKS is the usual and most flexible method – your SSH client can pretend to be a SOCKS proxy, and Axios appears to support using a SOCKS proxy with help of a separate module.
Enable the "SOCKS proxy" by adding a "Dynamic" tunnel within PuTTY's SSH>Tunnel settings. (Alternatively, for both ssh.exe
and plink.exe
, use the -D
option.) Test it out with curl -x
first – some SSH servers might be configured to disable tunnels.
Here's a random article I found about configuring Axios – while it talks about Tor, everything applies to any other kind of SOCKS server:
import { SocksProxyAgent } from "socks-proxy-agent";
const agent = new SocksProxyAgent("socks://127.0.0.1:9050");