Re: hosts porzekierowanie

Autor: Konrad Kosmowski <konrad_at_kosmosik.net>
Data: Fri 02 Apr 2010 - 00:03:18 MET DST
Message-ID: <6qhf87-i06.ln1@kosmosik.net>
Content-Type: text/plain; charset=ISO-8859-2

** Grzegorz Niemirowski <gnthexfiles@poczta.onet.pl> wrote:

>> wpis w hosts: 212.77.100.101 www.jakas_strona.pl spowoduje, że przeglądarka
>> po wipsaniu wwww.jakas_strona.pl trafi na strony wirtualnej polski. Jak
>> zrobić, by trafiła na spreparowaną stronkę, najlepiej zapisana lokalnie na
>> dysku komnputera lub na jakims darmowym serwerze ? na onecie to byłoby IP
>> strony www.cos_tam.republika.pl ale to iP wskazuje na republika.pl a nie
>> moją stronke.... PS. To ma być mały kawał na 1 kwietnia.

> Bo jak na jednym IP jest wiele stron to ten sposób się nie nadaje.

Weź doczytaj jak działa HTTP 1.1 - oczywiście, że się nadaje.

Klient w żądaniu HTTP wysyła nagłówek "Host" ustawiony na nazwę DNS, którą
otwierał. Na podstawie tego nagłówka serwer HTTP zwróci właściwą stronę
(wirtualnego hosta).

http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.6.1.1

  19.6.1.1 Changes to Simplify Multi-homed Web Servers and Conserve IP
  Addresses

                   The requirements that clients and servers support the Host request-
                   header, report an error if the Host request-header (section 14.23)
                   is missing from an HTTP/1.1 request, and accept absolute URIs
                   (section 5.1.2) are among the most important changes defined by this
                   specification.

                   Older HTTP/1.0 clients assumed a one-to-one relationship of IP
                   addresses and servers; there was no other established mechanism for
                   distinguishing the intended server of a request than the IP address
                   to which that request was directed. The changes outlined above will
                   allow the Internet, once older HTTP clients are no longer common, to
                   support multiple Web sites from a single IP address, greatly
                   simplifying large operational Web servers, where allocation of many
                   IP addresses to a single host has created serious problems. The
                   Internet will also be able to recover the IP addresses that have
                   been allocated for the sole purpose of allowing special-purpose
                   domain names to be used in root-level HTTP URLs. Given the rate of
                   growth of the Web, and the number of servers already deployed, it is
                   extremely

-- 
    +                                 '                      .-.     .
                               ,                         *    ) )
  http://kosmosik.net/                     .           .     '-'  . kK
Received on Fri Apr 2 00:05:03 2010

To archiwum zostało wygenerowane przez hypermail 2.1.8 : Fri 02 Apr 2010 - 00:42:01 MET DST