Some web sites can be accessed by IP address, others can not... why is this?

Kev

Lifer
Dec 17, 2001
16,367
4
81
Yeah but at work I'm working on a project where it would be helpful to know what the server configuration is. I have to set up a site that can not be accessed by IP address.
 

spidey07

No Lifer
Aug 4, 2000
65,469
5
76
There is this thing called a URL. This is what you request from a web server, or more specifically a URI. I'm not trying to talk down, but this is a very basic concept - you ask an application "gimme this, using this URI". In the application layer (HTTP) there are fields for host and URI, combined these are a URL, along with a lot of other stuff.

Best practice says you shouldn't accept HTTP requests with a URL of the IP only, but some sites still accept it. If you want to learn more google URL and URI and HTTP. When you're talking about IP address you're dealing with layer3, HTTP is layer 7. This is why you can run thousands of websites on a single IP address.
 

spidey07

No Lifer
Aug 4, 2000
65,469
5
76
Originally posted by: Kev
Yeah but at work I'm working on a project where it would be helpful to know what the server configuration is. I have to set up a site that can not be accessed by IP address.

So configure your web server to only answer to specific URL/URIs.
 

spidey07

No Lifer
Aug 4, 2000
65,469
5
76
Originally posted by: Kev
So in IIS I have to configure host headers to accomplish this?

Yes. As the operator of a web server you need to understand what you are doing.
 

Kev

Lifer
Dec 17, 2001
16,367
4
81
Well I'm not a network admin i'm a developer but thanks for the help
 

spidey07

No Lifer
Aug 4, 2000
65,469
5
76
Originally posted by: Kev
Well I'm not a network admin i'm a developer but thanks for the help

I didn't mean to be harsh, but as a developer you really should know this. Otherwise you can't properly develop.
 

mcmilljb

Platinum Member
May 17, 2005
2,144
2
81
RFC 2616 FTW

It should help explain http/1.1 which talks about http URL's and why you use hostnames instead of ip address in your requests/messages.

"The use of IP addresses in URLs SHOULD be avoided whenever possible (see RFC 1900 [24])"

PS - RFC 1900 is from 1996 and talks about renumbering on the Internet/network which is why they recommend to use hostnames instead of ip's. Basically keeping software from being hardcoded to a specific ip address.
 

alpineranger

Senior member
Feb 3, 2001
701
0
76
Besides the late binding of resources to ip addresses which is discussed, practically speaking there are web sites which share ip addresses (virtual servers). Thus the host name defines what site is served. Of course a default can be specified, but this would be a good justification for why this is done.