Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
March 1, 2009, 7:47 am
rate this thread
Re: ssh port forwarding doesn't resolve domains correctly?
The data sent in an HTTP request includes a Host: header containing
the hostname that the browser thinks it's looking up. This enables
multiple web sites to be served by the same IP address, because when
a request comes in to that address the Host: header disambiguates so
that the server can tell which site it's supposed to be returning.
So your browser is connecting to localhost:81 and sending a request
including "Host: localhost". PuTTY (or any other SSH client) will
forward the connection to whatismyip.com:80, but won't rewrite the
Host: header. Hence, whatismyip.com receives an HTTP request with
"Host: localhost" in it, so it returns whatever site it happens to
think is appropriate for that.
SOCKS-based dynamic forwarding would be one way to solve this: have
PuTTY open a port for dynamic forwarding, and then tell your web
browser to use that port as a SOCKS web proxy. Then the browser
still knows what web site it's ultimately trying to reach, and so it
can write the correct Host: header.
(However, if you only want to forward connections to that one
_particular_ site and have your browser connect normally to
everywhere else, you may have to do gymnastics in your browser
configuration: either keep turning the forwarding on and off, or
Simon Tatham "The voices in my head are trying to ignore me.
- » plink/putty remote command not working as expected
- — Next thread in » Secure Shell Forum
- » ssh on command line: force using a group size (prime size) of 1024 (and no...
- — Newest thread in » Secure Shell Forum