https://en.wikipedia.org/wiki/Proxy_server#Types_of_proxy_servers says

A proxy server may reside on the user's local computer, or at any point between the user's computer and destination servers on the Internet.

  • A proxy server that passes unmodified requests and responses is usually called a gateway or sometimes a tunneling proxy.

  • A forward proxy is an Internet-facing proxy used to retrieve data from a wide range of sources (in most cases anywhere on the Internet).

  • A reverse proxy is usually an internal-facing proxy used as a front-end to control and protect access to a server on a private network. A reverse proxy commonly also performs tasks such as load-balancing, authentication, decryption and caching.

From Gourley's HTTP: The Definitive Guide

Strictly speaking, proxies connect two or more applications that speak the same protocol, while gateways hook up two or more parties that speak different protocols. A gateway acts as a “protocol converter,” allowing a client to complete a transaction with a server, even when the client and server speak different protocols.

Figure 6-2 illustrates the difference between proxies and gateways:

• The intermediary device in Figure 6-2a is an HTTP proxy, because the proxy speaks HTTP to both the client and server.

• The intermediary device in Figure 6-2b is an HTTP/POP gateway, because it ties an HTTP frontend to a POP email backend. The gateway converts web transactions into the appropriate POP transactions, to allow the user to read email through HTTP. Web-based email programs such as Yahoo! Mail and MSN Hot- mail are HTTP email gateways.

In practice, the difference between proxies and gateways is blurry. Because browsers and servers implement different versions of HTTP, proxies often do some amount of protocol conversion. And commercial proxy servers implement gateway functional- ity to support SSL security protocols, SOCKS firewalls, FTP access, and web-based applications.

enter image description here

Are the definitions of gateway in the two sources contradicting each other? The first says a gateway pass received requests and responses without modification, while the second says a gateway connects parties that speak different protocols and convert between the two protocols? How do you understand the concept of gateway, reconciling any difference between the two definitions?

Ngnix can be used as a reverse proxy server, when the proxied server is a CGI server, according to its official online document. A reverse proxy server is a proxy server by the first source, and by the second source, it speaks to the two parties which it connects using the same protocol. Here, Ngnix speaks to its client using HTTP, and should Ngnix also speak HTTP or some other protocol with the CGI server?



Communication with CGI scripts is done using the Common Gateway Interface. It is a sort of calling convention, where HTTP headers and the requested URL are passed through environment variables, whereas the request data are passed on stdin. This is a local communication as the web server must run the CGI script as a process on the same machine.

FastCGI is a slight variation where everything is passed to the CGI script using a stream socket and a binary protocol. The socket is usually a UNIX socket (so local), but can be also a regular TCP/IP connection.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.