cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Ignore DNS

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 12 Jun 2002 19:48:26 +0200 (MET DST)

On Wed, 12 Jun 2002, Warrick FitzGerald wrote:

> I very often would like to make a request to a specific IP Address, but
> keep the host header etc exactly as if curl had done the lookup via DNS.
>
> For eample if I have 3 web servers behind a load ballancer, I would like to
> be able to make a request directly to Machine1's private address, with
> excly the same header as if it had resolved to the LoadBallanced IP.
>
> Is it possible to do something like curl www.mysite.com --user-this-ip
> 10.10.10.5 ?

Yes it is indeed possible. You just need to "scramble" the options a little:

 curl --header "Host: www.mysite.com" http://10.10.10.5

This makes a HTTP request to 10.10.10.5 and replaces the otherwise internally
generated "Host:" header with one of your own choice. The Host: header is
what tells the server which (virtual) server you want.

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
_______________________________________________________________
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
Received on 2002-06-12