ssh local port forwarding not working

2

My goal:

I have a computer in a location A, let's call it host-A. I have a computer in a location B (host-B) running an ssh server, and I can ssh from host-A into host-B. I want to access a website on the web browser of host-A, say http://example.com/ via an ssh tunnel through host-B.

What I did:

In host-A, I type ssh -v -N -L 8080:example.com:80 host-B. I can check using netstat --inet -lnp that ssh is indeed listening on 127.0.0.1:8080, with foreign address 0.0.0.0:*. In host-B, I can access example.com. Hence in host-A browser (firefox here), when I type the url "http://localhost:8080/", I should access the example.com webpage.

My questions:

When I do this, I actually get a 404 not found. Yet, in the shell in which I issued the "ssh -L", I see some logs, for instance:

debug1: Connection to port 8080 forwarding to example.com port 80 requested.

(1) So what happened here? I did exactly the same (except using example.com) as, e.g., this example on local port forwarding.

When I try with "www.ubuntuforums.org" (so ssh -v -N -L 8080:www.ubuntuforums.org:80 host-B in host-A), http://localhost:8080/ actually takes me to "https://www.canonical.com/". (2) Why is that?

When I try with ssh -v -N -L 8080:www.stackoverflow.com:80 host-B, I get:

Fastly error: unknown domain: localhost. Please check that this domain has been added to a service. Details: cache-cdg20728-CDG (3) Again, why? So many mysteries for me here...

Gru-gru

Posted 2019-01-02T12:45:05.703

Reputation: 121

Question was closed 2019-01-02T13:02:46.370

No answers