How to send an HTTP request for a certain domain name to a specific IP address?

Solution 1:

You can use CURL to initiate a request to the server with a custom host header.

curl --header "Host:abc.com" xxxx.xxxx.xxxx.xxxx

Solution 2:

Sure, if you do it by hand its easy.

At a shell prompt: sleep 1; echo GET /some/resource HTTP/1.1; echo host: google.com; echo ''; sleep 10)|tee /dev/tty|telnet 127.0.0.1 80

This will connect to localhost =127.0.0.1 on the http port = 80 and request http://google.com/some/resource

You can do the corresponding in some program of course. The trick is to not rely on the browser or web component to parse the url and use that information to establish a connection.

Solution 3:

There is a Google Chrome extension called DNS Overrider that will allow you to enable a DNS override of a URL on a page. For example, if I had a local html file on my computer that IFRAME'd a url (http://example.com) then I could use this extension to create an alias that points to 1.1.1.1.

However, keep in mind that this will not work in your address bar. It will only work on the URLs within a page. Using the IFRAME element should work.