Why does typing an IP address instead of the corresponding domain name not show the website?
up vote
12
down vote
favorite
> host example.com
example.com has address 93.184.216.34
example.com has IPv6 address 2606:2800:220:1:248:1893:25c8:1946
I type 93.184.216.34
instead of http://example.com
in Chrome. It doesn't load the website. Why?
ip google-chrome
New contributor
add a comment |
up vote
12
down vote
favorite
> host example.com
example.com has address 93.184.216.34
example.com has IPv6 address 2606:2800:220:1:248:1893:25c8:1946
I type 93.184.216.34
instead of http://example.com
in Chrome. It doesn't load the website. Why?
ip google-chrome
New contributor
5
For a better question please explain why you think it should.
– Lightness Races in Orbit
yesterday
add a comment |
up vote
12
down vote
favorite
up vote
12
down vote
favorite
> host example.com
example.com has address 93.184.216.34
example.com has IPv6 address 2606:2800:220:1:248:1893:25c8:1946
I type 93.184.216.34
instead of http://example.com
in Chrome. It doesn't load the website. Why?
ip google-chrome
New contributor
> host example.com
example.com has address 93.184.216.34
example.com has IPv6 address 2606:2800:220:1:248:1893:25c8:1946
I type 93.184.216.34
instead of http://example.com
in Chrome. It doesn't load the website. Why?
ip google-chrome
ip google-chrome
New contributor
New contributor
edited 15 mins ago
David Stockinger
1033
1033
New contributor
asked yesterday
PerrierCitror
1665
1665
New contributor
New contributor
5
For a better question please explain why you think it should.
– Lightness Races in Orbit
yesterday
add a comment |
5
For a better question please explain why you think it should.
– Lightness Races in Orbit
yesterday
5
5
For a better question please explain why you think it should.
– Lightness Races in Orbit
yesterday
For a better question please explain why you think it should.
– Lightness Races in Orbit
yesterday
add a comment |
3 Answers
3
active
oldest
votes
up vote
43
down vote
accepted
Because the proper HTTP Host
header is often required to actually get the intended site.
It's very common to host multiple web sites on the same IP address and distinguish between them based on the HTTP Host
header specified by the client (as well as the TLS SNI value nowadays in the case of HTTPS).
That is, when you entered http://example.com
into your browser the Host
header was example.com
, but that is not the case when you entered 93.184.216.34
.
You reach the same web server in both cases, but you receive different responses (in this particular case 200 vs. 404).
Could someone expand a little on whatHost
does and what web servers generally use it for? It's kind of hard to search for online because that word is so overloaded.
– user1717828
yesterday
tools.ietf.org/html/rfc7230#section-5.4 A http server processes a Host header however it wants to. httpd for example has VirtualHost configuration directives.
– John Mahowald
yesterday
@user1717828 The main use-case is what I describe in the answer.
– Håkan Lindqvist
yesterday
8
@SergiyKolodyazhnyy Sure. You couldcurl -H "Host: example.com" http://93.184.216.34/
or something like that.
– Håkan Lindqvist
yesterday
1
To paraphrase - "there is not a one-to-one relationship between URLs for websites and IP address."
– Pete
23 hours ago
|
show 5 more comments
up vote
3
down vote
Because usually web servers use "virtual server" technology and are able to answer on your HTTP request within exactly the domain name you request, but not the IP address of the web servers. Thanks to hiding more than one domain name on one IP address.
For example, the Apache web server is able to respond to your HTTP request with an IP address using the section:
<VirtualHost *:80>
ServerName Default
...
</VirtualHost>
or if No VirtualHost used in configuration at all.
The VirtualHost feature in Apache was introduced in 1996.
add a comment |
up vote
1
down vote
In Apache, you can host many websites using just one single IP address. This is called virtual hosting. It's how subdomains can be created, even standalone domains. This is done by setting up an Apache configuration file containing VirtualHost directives for each domain/subdomain.
An example HTTP server that has two virtual hosts, example1.com and example2.com can look like this (IP address definition):
<VirtualHost 93.184.216.34:80>
ServerName example1.com
ServerAlias www.example1.com
DocumentRoot /var/www/example1.com
</VirtualHost>
<VirtualHost 93.184.216.34:80>
ServerName example2.com
ServerAlias www.example2.com
DocumentRoot /var/www/example2.com
</VirtualHost>
It can also look like this (name-based definition):
<VirtualHost *:80>
ServerName example1.com
ServerAlias www.example1.com
DocumentRoot /var/www/example1.com
</VirtualHost>
<VirtualHost *:80>
ServerName example2.com
ServerAlias www.example2.com
DocumentRoot /var/www/example2.com
</VirtualHost>
In both cases, two virtual host records are created internally in memory and used by Apache to compare against when a URI request arrives.
When a user types in the IP address via a user agent, the first virtual host listed in the configuration file is used as the primary domain (i.e. in this case example1.com).
When a user types in a domain name, the request is sent to a public Internet DNS network (ICANN) which provides the IP address associated with it. You registered both via an ICANN registrar (like GoDaddy). You must have both of these correct and give some time before propagation takes hold to all DNS servers on the ICANN network. These days it can take up to 24 hours.
When the request is routed to your Apache HTTP server, the IP address and domain name are matched against the list of internal VirtualHost records. When one is found, the document root is used to form the full filesystem path to the object resource to return back to the user agent. If not, a HTTP 404 is sent along with any error document associated with it.
New contributor
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
43
down vote
accepted
Because the proper HTTP Host
header is often required to actually get the intended site.
It's very common to host multiple web sites on the same IP address and distinguish between them based on the HTTP Host
header specified by the client (as well as the TLS SNI value nowadays in the case of HTTPS).
That is, when you entered http://example.com
into your browser the Host
header was example.com
, but that is not the case when you entered 93.184.216.34
.
You reach the same web server in both cases, but you receive different responses (in this particular case 200 vs. 404).
Could someone expand a little on whatHost
does and what web servers generally use it for? It's kind of hard to search for online because that word is so overloaded.
– user1717828
yesterday
tools.ietf.org/html/rfc7230#section-5.4 A http server processes a Host header however it wants to. httpd for example has VirtualHost configuration directives.
– John Mahowald
yesterday
@user1717828 The main use-case is what I describe in the answer.
– Håkan Lindqvist
yesterday
8
@SergiyKolodyazhnyy Sure. You couldcurl -H "Host: example.com" http://93.184.216.34/
or something like that.
– Håkan Lindqvist
yesterday
1
To paraphrase - "there is not a one-to-one relationship between URLs for websites and IP address."
– Pete
23 hours ago
|
show 5 more comments
up vote
43
down vote
accepted
Because the proper HTTP Host
header is often required to actually get the intended site.
It's very common to host multiple web sites on the same IP address and distinguish between them based on the HTTP Host
header specified by the client (as well as the TLS SNI value nowadays in the case of HTTPS).
That is, when you entered http://example.com
into your browser the Host
header was example.com
, but that is not the case when you entered 93.184.216.34
.
You reach the same web server in both cases, but you receive different responses (in this particular case 200 vs. 404).
Could someone expand a little on whatHost
does and what web servers generally use it for? It's kind of hard to search for online because that word is so overloaded.
– user1717828
yesterday
tools.ietf.org/html/rfc7230#section-5.4 A http server processes a Host header however it wants to. httpd for example has VirtualHost configuration directives.
– John Mahowald
yesterday
@user1717828 The main use-case is what I describe in the answer.
– Håkan Lindqvist
yesterday
8
@SergiyKolodyazhnyy Sure. You couldcurl -H "Host: example.com" http://93.184.216.34/
or something like that.
– Håkan Lindqvist
yesterday
1
To paraphrase - "there is not a one-to-one relationship between URLs for websites and IP address."
– Pete
23 hours ago
|
show 5 more comments
up vote
43
down vote
accepted
up vote
43
down vote
accepted
Because the proper HTTP Host
header is often required to actually get the intended site.
It's very common to host multiple web sites on the same IP address and distinguish between them based on the HTTP Host
header specified by the client (as well as the TLS SNI value nowadays in the case of HTTPS).
That is, when you entered http://example.com
into your browser the Host
header was example.com
, but that is not the case when you entered 93.184.216.34
.
You reach the same web server in both cases, but you receive different responses (in this particular case 200 vs. 404).
Because the proper HTTP Host
header is often required to actually get the intended site.
It's very common to host multiple web sites on the same IP address and distinguish between them based on the HTTP Host
header specified by the client (as well as the TLS SNI value nowadays in the case of HTTPS).
That is, when you entered http://example.com
into your browser the Host
header was example.com
, but that is not the case when you entered 93.184.216.34
.
You reach the same web server in both cases, but you receive different responses (in this particular case 200 vs. 404).
edited 17 hours ago
Peter Mortensen
2,09742124
2,09742124
answered yesterday
Håkan Lindqvist
21k33660
21k33660
Could someone expand a little on whatHost
does and what web servers generally use it for? It's kind of hard to search for online because that word is so overloaded.
– user1717828
yesterday
tools.ietf.org/html/rfc7230#section-5.4 A http server processes a Host header however it wants to. httpd for example has VirtualHost configuration directives.
– John Mahowald
yesterday
@user1717828 The main use-case is what I describe in the answer.
– Håkan Lindqvist
yesterday
8
@SergiyKolodyazhnyy Sure. You couldcurl -H "Host: example.com" http://93.184.216.34/
or something like that.
– Håkan Lindqvist
yesterday
1
To paraphrase - "there is not a one-to-one relationship between URLs for websites and IP address."
– Pete
23 hours ago
|
show 5 more comments
Could someone expand a little on whatHost
does and what web servers generally use it for? It's kind of hard to search for online because that word is so overloaded.
– user1717828
yesterday
tools.ietf.org/html/rfc7230#section-5.4 A http server processes a Host header however it wants to. httpd for example has VirtualHost configuration directives.
– John Mahowald
yesterday
@user1717828 The main use-case is what I describe in the answer.
– Håkan Lindqvist
yesterday
8
@SergiyKolodyazhnyy Sure. You couldcurl -H "Host: example.com" http://93.184.216.34/
or something like that.
– Håkan Lindqvist
yesterday
1
To paraphrase - "there is not a one-to-one relationship between URLs for websites and IP address."
– Pete
23 hours ago
Could someone expand a little on what
Host
does and what web servers generally use it for? It's kind of hard to search for online because that word is so overloaded.– user1717828
yesterday
Could someone expand a little on what
Host
does and what web servers generally use it for? It's kind of hard to search for online because that word is so overloaded.– user1717828
yesterday
tools.ietf.org/html/rfc7230#section-5.4 A http server processes a Host header however it wants to. httpd for example has VirtualHost configuration directives.
– John Mahowald
yesterday
tools.ietf.org/html/rfc7230#section-5.4 A http server processes a Host header however it wants to. httpd for example has VirtualHost configuration directives.
– John Mahowald
yesterday
@user1717828 The main use-case is what I describe in the answer.
– Håkan Lindqvist
yesterday
@user1717828 The main use-case is what I describe in the answer.
– Håkan Lindqvist
yesterday
8
8
@SergiyKolodyazhnyy Sure. You could
curl -H "Host: example.com" http://93.184.216.34/
or something like that.– Håkan Lindqvist
yesterday
@SergiyKolodyazhnyy Sure. You could
curl -H "Host: example.com" http://93.184.216.34/
or something like that.– Håkan Lindqvist
yesterday
1
1
To paraphrase - "there is not a one-to-one relationship between URLs for websites and IP address."
– Pete
23 hours ago
To paraphrase - "there is not a one-to-one relationship between URLs for websites and IP address."
– Pete
23 hours ago
|
show 5 more comments
up vote
3
down vote
Because usually web servers use "virtual server" technology and are able to answer on your HTTP request within exactly the domain name you request, but not the IP address of the web servers. Thanks to hiding more than one domain name on one IP address.
For example, the Apache web server is able to respond to your HTTP request with an IP address using the section:
<VirtualHost *:80>
ServerName Default
...
</VirtualHost>
or if No VirtualHost used in configuration at all.
The VirtualHost feature in Apache was introduced in 1996.
add a comment |
up vote
3
down vote
Because usually web servers use "virtual server" technology and are able to answer on your HTTP request within exactly the domain name you request, but not the IP address of the web servers. Thanks to hiding more than one domain name on one IP address.
For example, the Apache web server is able to respond to your HTTP request with an IP address using the section:
<VirtualHost *:80>
ServerName Default
...
</VirtualHost>
or if No VirtualHost used in configuration at all.
The VirtualHost feature in Apache was introduced in 1996.
add a comment |
up vote
3
down vote
up vote
3
down vote
Because usually web servers use "virtual server" technology and are able to answer on your HTTP request within exactly the domain name you request, but not the IP address of the web servers. Thanks to hiding more than one domain name on one IP address.
For example, the Apache web server is able to respond to your HTTP request with an IP address using the section:
<VirtualHost *:80>
ServerName Default
...
</VirtualHost>
or if No VirtualHost used in configuration at all.
The VirtualHost feature in Apache was introduced in 1996.
Because usually web servers use "virtual server" technology and are able to answer on your HTTP request within exactly the domain name you request, but not the IP address of the web servers. Thanks to hiding more than one domain name on one IP address.
For example, the Apache web server is able to respond to your HTTP request with an IP address using the section:
<VirtualHost *:80>
ServerName Default
...
</VirtualHost>
or if No VirtualHost used in configuration at all.
The VirtualHost feature in Apache was introduced in 1996.
edited 17 hours ago
Peter Mortensen
2,09742124
2,09742124
answered yesterday
Алексей Лебедев
391
391
add a comment |
add a comment |
up vote
1
down vote
In Apache, you can host many websites using just one single IP address. This is called virtual hosting. It's how subdomains can be created, even standalone domains. This is done by setting up an Apache configuration file containing VirtualHost directives for each domain/subdomain.
An example HTTP server that has two virtual hosts, example1.com and example2.com can look like this (IP address definition):
<VirtualHost 93.184.216.34:80>
ServerName example1.com
ServerAlias www.example1.com
DocumentRoot /var/www/example1.com
</VirtualHost>
<VirtualHost 93.184.216.34:80>
ServerName example2.com
ServerAlias www.example2.com
DocumentRoot /var/www/example2.com
</VirtualHost>
It can also look like this (name-based definition):
<VirtualHost *:80>
ServerName example1.com
ServerAlias www.example1.com
DocumentRoot /var/www/example1.com
</VirtualHost>
<VirtualHost *:80>
ServerName example2.com
ServerAlias www.example2.com
DocumentRoot /var/www/example2.com
</VirtualHost>
In both cases, two virtual host records are created internally in memory and used by Apache to compare against when a URI request arrives.
When a user types in the IP address via a user agent, the first virtual host listed in the configuration file is used as the primary domain (i.e. in this case example1.com).
When a user types in a domain name, the request is sent to a public Internet DNS network (ICANN) which provides the IP address associated with it. You registered both via an ICANN registrar (like GoDaddy). You must have both of these correct and give some time before propagation takes hold to all DNS servers on the ICANN network. These days it can take up to 24 hours.
When the request is routed to your Apache HTTP server, the IP address and domain name are matched against the list of internal VirtualHost records. When one is found, the document root is used to form the full filesystem path to the object resource to return back to the user agent. If not, a HTTP 404 is sent along with any error document associated with it.
New contributor
add a comment |
up vote
1
down vote
In Apache, you can host many websites using just one single IP address. This is called virtual hosting. It's how subdomains can be created, even standalone domains. This is done by setting up an Apache configuration file containing VirtualHost directives for each domain/subdomain.
An example HTTP server that has two virtual hosts, example1.com and example2.com can look like this (IP address definition):
<VirtualHost 93.184.216.34:80>
ServerName example1.com
ServerAlias www.example1.com
DocumentRoot /var/www/example1.com
</VirtualHost>
<VirtualHost 93.184.216.34:80>
ServerName example2.com
ServerAlias www.example2.com
DocumentRoot /var/www/example2.com
</VirtualHost>
It can also look like this (name-based definition):
<VirtualHost *:80>
ServerName example1.com
ServerAlias www.example1.com
DocumentRoot /var/www/example1.com
</VirtualHost>
<VirtualHost *:80>
ServerName example2.com
ServerAlias www.example2.com
DocumentRoot /var/www/example2.com
</VirtualHost>
In both cases, two virtual host records are created internally in memory and used by Apache to compare against when a URI request arrives.
When a user types in the IP address via a user agent, the first virtual host listed in the configuration file is used as the primary domain (i.e. in this case example1.com).
When a user types in a domain name, the request is sent to a public Internet DNS network (ICANN) which provides the IP address associated with it. You registered both via an ICANN registrar (like GoDaddy). You must have both of these correct and give some time before propagation takes hold to all DNS servers on the ICANN network. These days it can take up to 24 hours.
When the request is routed to your Apache HTTP server, the IP address and domain name are matched against the list of internal VirtualHost records. When one is found, the document root is used to form the full filesystem path to the object resource to return back to the user agent. If not, a HTTP 404 is sent along with any error document associated with it.
New contributor
add a comment |
up vote
1
down vote
up vote
1
down vote
In Apache, you can host many websites using just one single IP address. This is called virtual hosting. It's how subdomains can be created, even standalone domains. This is done by setting up an Apache configuration file containing VirtualHost directives for each domain/subdomain.
An example HTTP server that has two virtual hosts, example1.com and example2.com can look like this (IP address definition):
<VirtualHost 93.184.216.34:80>
ServerName example1.com
ServerAlias www.example1.com
DocumentRoot /var/www/example1.com
</VirtualHost>
<VirtualHost 93.184.216.34:80>
ServerName example2.com
ServerAlias www.example2.com
DocumentRoot /var/www/example2.com
</VirtualHost>
It can also look like this (name-based definition):
<VirtualHost *:80>
ServerName example1.com
ServerAlias www.example1.com
DocumentRoot /var/www/example1.com
</VirtualHost>
<VirtualHost *:80>
ServerName example2.com
ServerAlias www.example2.com
DocumentRoot /var/www/example2.com
</VirtualHost>
In both cases, two virtual host records are created internally in memory and used by Apache to compare against when a URI request arrives.
When a user types in the IP address via a user agent, the first virtual host listed in the configuration file is used as the primary domain (i.e. in this case example1.com).
When a user types in a domain name, the request is sent to a public Internet DNS network (ICANN) which provides the IP address associated with it. You registered both via an ICANN registrar (like GoDaddy). You must have both of these correct and give some time before propagation takes hold to all DNS servers on the ICANN network. These days it can take up to 24 hours.
When the request is routed to your Apache HTTP server, the IP address and domain name are matched against the list of internal VirtualHost records. When one is found, the document root is used to form the full filesystem path to the object resource to return back to the user agent. If not, a HTTP 404 is sent along with any error document associated with it.
New contributor
In Apache, you can host many websites using just one single IP address. This is called virtual hosting. It's how subdomains can be created, even standalone domains. This is done by setting up an Apache configuration file containing VirtualHost directives for each domain/subdomain.
An example HTTP server that has two virtual hosts, example1.com and example2.com can look like this (IP address definition):
<VirtualHost 93.184.216.34:80>
ServerName example1.com
ServerAlias www.example1.com
DocumentRoot /var/www/example1.com
</VirtualHost>
<VirtualHost 93.184.216.34:80>
ServerName example2.com
ServerAlias www.example2.com
DocumentRoot /var/www/example2.com
</VirtualHost>
It can also look like this (name-based definition):
<VirtualHost *:80>
ServerName example1.com
ServerAlias www.example1.com
DocumentRoot /var/www/example1.com
</VirtualHost>
<VirtualHost *:80>
ServerName example2.com
ServerAlias www.example2.com
DocumentRoot /var/www/example2.com
</VirtualHost>
In both cases, two virtual host records are created internally in memory and used by Apache to compare against when a URI request arrives.
When a user types in the IP address via a user agent, the first virtual host listed in the configuration file is used as the primary domain (i.e. in this case example1.com).
When a user types in a domain name, the request is sent to a public Internet DNS network (ICANN) which provides the IP address associated with it. You registered both via an ICANN registrar (like GoDaddy). You must have both of these correct and give some time before propagation takes hold to all DNS servers on the ICANN network. These days it can take up to 24 hours.
When the request is routed to your Apache HTTP server, the IP address and domain name are matched against the list of internal VirtualHost records. When one is found, the document root is used to form the full filesystem path to the object resource to return back to the user agent. If not, a HTTP 404 is sent along with any error document associated with it.
New contributor
edited 17 hours ago
Peter Mortensen
2,09742124
2,09742124
New contributor
answered yesterday
Kerry Kobashi
1193
1193
New contributor
New contributor
add a comment |
add a comment |
PerrierCitror is a new contributor. Be nice, and check out our Code of Conduct.
PerrierCitror is a new contributor. Be nice, and check out our Code of Conduct.
PerrierCitror is a new contributor. Be nice, and check out our Code of Conduct.
PerrierCitror is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f942430%2fwhy-does-typing-an-ip-address-instead-of-the-corresponding-domain-name-not-show%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
5
For a better question please explain why you think it should.
– Lightness Races in Orbit
yesterday