In collaboration with the HTTP Web server

Implement multiple domain names with a single virtual host

HTTP / 1.1 specification allows a HTTP server set up multiple Web sites. This is because the use of the virtual host (Virtual Host, also known as virtual server) functions of
multiple servers even if the physical level, only one server, but as long as the use of web hosting features, you may have been imaginary.
When within a server hosting multiple domains, when a request is received it is necessary to find out exactly which domain name you want to access.
In the same IP address, since the virtual host can register a number of different host name and domain name of the site, so when sending HTTP requests, you must specify the full URI host name or domain name in the header Host.

Communication data forwarding procedure: proxy, gateway, tunnel

When the HTTP communication, in addition to the client and the server, for some applications the communication data forwarding, e.g. proxies, gateways and the tunnel. They can work with the server.

  • Agent:
    Acting is a kind of application forwarding function, which plays a role in the server and the client "middleman" of receiving the request sent by the client and forwarded to the server, but also to receive a response returned by the server and forwarded to the customer end.
  • Gateway:
    the gateway server to other servers to forward communication data, when receiving a request from a client over, it's like they own resources as the source server to process the request.
  • Tunnel:
    the tunnel is in transit between the two far apart the customer end and server, and keep both the application communication connection.

proxy:

The basic behavior is to accept the proxy server forwards the request to the other server sent by the client. The agent does not change request URI, it will be sent directly to the target server front to hold resources.
In the HTTP communication, multiple proxy servers may be cascaded. Forwarding requests and responses through several similar chains as a proxy server connected. When forwarding, additional Via header field to mark the passing host information.
The reason for using a proxy server are:
1) the use ofCachingReduce bandwidth traffic
inside 2) organizational control access to specific websites
3) to obtain access logs for the primary purpose of
the agent to use a variety of methods, classified in two benchmarks. One is whether to use the cache, the other is whether it will modify the message.

  • Proxy caching
    proxy forwards a response, the proxy cache (Caching Proxy) will advance copy of the resource (cache) saved on the proxy server.
    When the agent receives a request for the same resource again, it can not be acquired from a source server where the resource, but the resource before the cache is returned as the response.
  • Transparent proxy
    forwarding requests or responses, does not do any packet processing type is called transparent proxy agent (Transparent Proxy). On the contrary, the agent for the processing of the message content called non-transparent proxy.

Gateway

Gateways and agents working mechanism is very similar. The gateway enables the server on the communication line to provide non-HTTP protocol services.
Using the gateway communication security can be improved, as can the encryption on the communication line between the client and the gateway in order to ensure a secure connection.

tunnel

A tunnel may be required to establish a communication line with other servers, when the use of encryption, such as SSL communication. The purpose of the tunnel is to ensure that the client and the server can beSafetyCommunication.
The tunnel itself will not go parsing HTTP request. In other words, after the request to the server as it is transferred to the hold request. Tunnel will end when the communicating parties are disconnected.

The role of the three under Summary:
Agent role: to reduce bandwidth consumption, access control, such as a corporate intranet access external networks, scientific Internet (proxy risk)
gateway acts: protocol conversion, such as credit card settlement on the Web shopping site, and joint credit card settlement system
of the tunnel effect: long-range secure communication, such as through the company intranet extranet access

Save the resource cache

Cache server is a proxy server, and classified in the cache proxy type.
The advantages of caching server that can use the cache to avoid multiple forwarding resources from the source server. Thus clients can obtain resources from the nearest cache server, and the source server does not have to be repeatedly treated in the same request.

Cache expiration date

Cache is good, but there will be improper use of dirty data cache is the case, this time on the need at the time of the request, confirmed by the cache server to the source server if the data has been updated, if updated, you need to get new data.

Client caching

Cache can only exist in the cache server may also be present in the client browser.
With Internet Explorer program, for example, the client cache is called Temporary Internet Files (Temporary Internet File)
and cache server the same thing is that when judging the cache expires, will confirm the availability of resources to the source server. If the judge fails browser cache, browser requests the new resource again.

Published 75 original articles · won praise 7 · views 10000 +

Guess you like

Origin blog.csdn.net/zhengdong12345/article/details/99692067