SSH – Browsing Localhost via SOCKS Tunnel Not Working

socks5-proxyssh

I used to have a successful configuration in my local computer to access a remote host's web server via SSH SOCKS proxy, by typing in Firefox localhost:5000 for example. I created a rule in the server's firewall to only allow local access to this application.

I haven't used it for a while and in the meantime I updated my local computer to Ubuntu 18.10. And now that setup is not working anymore. 127.0.0.1:5000 doesn't work either.

The SOCKS setup is actually working – I can see the browser detecting the local IP to be the remote server's and I can browse the Internet normally through the SOCKS proxy. I can in fact access the remote web server by pointing Firefox to the server's external_ip:5000 (let's say http://180.129.54.204:5000). At the same time, using the same external_ip:5000 from a different browser program (Chromium) that is configured to connect directly, the result is a connection error, as expected.

When establishing the SSH connection with the -vvv flag, I see activity every time I open a webpage, but when trying to open localhost:5000 nothing happens, as if the request is not even reaching the SSH connection.

If I set the port wrong and point the browser to access external_ip:5000, I get the error page 'The proxy server is refusing connections'. On the other hand, when trying to access localhost:5000 whatever the config I only see 'Unable to connect'.

I checked several times, in Firefox's network configuration the field for 'No proxy for' is empty.
enter image description here

I also tried to configure Chromium to use the SOCKS proxy instead of Firefox, but the result is the same. Also double checked 'no proxy for' to be empty in this case.

My local /etc/hosts

127.0.0.1   localhost
127.0.1.1   My_computer_name

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

I don't know what changed in my system. Is anyone able to point out the problem or at least indicate log files I should be monitoring and where to look for clues?

Best Answer

Change network.proxy.allow_hijacking_localhost to true in about:settings.

Related Question