[PLUG] Browsers, Numeric IPs, and apache Virtual Hosts
Martin A. Brown
martin at linux-ip.net
Fri May 4 01:08:02 UTC 2012
Greetz Keith,
: Apache uses virtual hosts to support many different URLs on one
: machine on one IP address. When you connect to apache with your
: browser, the browser provides enough information to Apache to
: give you the URL you want.
:
: Question: If the URL is not in the DNS system, and all you have
: is the IP address (say, 1.2.3.4) and the name of the virtual
: (say, foobar.example.org ), how do you use firefox (or other
: browser)
Many people would not agree that 'curl' is an acceptable other
browser. With that disclaimer, I will point out that, you can use
the --header option to my curl (7.20.1) which will set the 'Host'
header appropriately:
curl \
--trace-ascii diagnosis.txt \
--header 'Host: linux-ip.net' \
-- http://64.22.109.68/
This does several things:
1. Connects via HTTP to 64.22.109.68
2. Adds the HTTP header 'Host: linux-ip.net'
3. Dumps the ASCII representation of the conversation to a file
called diagnosis.txt.
It can be quite handy when you are dealing with HTTP services that
require a bit of diagnostics. I am not Swiss, however, my Swiss
army CLI network knife is 'socat' where the HTTP CLI equivalent is
curl.
: to tell apache at 1.2.3.4 to serve the foobar.example.org
: content, or any of the other specific URLs served by virtual
: hosts on that machine?
:
: The best way is to provide good DNS, of course, but that isn't
: available if all you control is a user account and a browser.
And also, I agree with Paul Heinlein. Using /etc/hosts is one way
to work around this sort of impoverished infrastructural
environment, should you find yourself so constrained.
-Martin
--
Martin A. Brown
http://linux-ip.net/
More information about the PLUG
mailing list