Spiegato, Home

Technology and Gadgets

What is the Common Gateway Interface?

  • Published by Spiegato
  • 2 min read

In the realm of computers, a gateway can be several things, including a node that physically connects disparate networks, converting their protocols so they can communicate, or a functional service that provides an intermediary between multiple systems. Gateway programs can act as gateways between server-side resources — like databases — and the web. The Common Gateway Interface (CGI) was the initial mechanism that served as a generic interface between the server and these server-side gateway programs, and was used by most servers to process client requests that required server-side data processing. It is a standard, as well as an interface.

The Common Gateway Interface works in two directions. Suppose that a user sends a request through a web browser, such as submitting an HTML form with data in order to be added to a mailing list. The HTTP server can only serve documents, not process the data. So once the HTTP (HyperText Transfer Protocol) of data to the server is complete, the Common Gateway Interface conveys the data from the server to the gateway program that connects to the database. The results of the processing, such as a confirmation message, are returned to the user traveling on the path in reverse: from the database to the gateway program through the Common Gateway Interface to the server, through HTTP to the user’s web browser.

A Common Gateway Interface script is the name of the software program that was used to process a query to a database. It had the benefit of being operating system agnostic, meaning it would work on a server no matter which operating system it was running. While CGI was much used in the early days of the web, there are now newer, more efficient server-side methods for processing queries, and these are now found as well. These include ASP (Active Server Page) and its newer version ASP.NET (Active Server Page for dot-net, also known as ASP+) and JSP® (JavaServer Page), which allows the combination of HTML (HyperText Markup Language) and Java to work smoothly together on a single web page, but note that ASP is made by Microsoft® and only runs on Microsoft® web servers.

CGI itself has also developed. FastCGI™, an open standard, language-independent extension of CGI that allows for distributed computing, and — unlike CGI — does not exit after each request is complete, but persists, waiting for the next request. SCGI (Simple CGI) is another alternative, both a protocol and a program, placed in the public domain by its creator.

Key terms in this article

Related articles

  • What is a Serial Communications Interface?

    The serial communications interface (SCI) is a means by which computer components can communicate with each other. This can be within a computer itself…

  • What Is a Command Line Interface?

    A command line interface (CLI) is a computer instrument that allows users to control computers through a text command — or command line — instead of a…

  • What is a Threat Management Gateway?

    A threat management gateway (TMG) is the unified threat management (UTM) software system created by Microsoft® Corporation® as part of its Forefront®…

  • What is a Bluetooth® Gateway?

    A Bluetooth® Gateway refers to a device used to connect Bluetooth® products to other hardware. A stereo or audio Bluetooth® Gateway, for example, connects…

  • What is an Interior Gateway Protocol?

    An interior gateway protocol (IGP) is a method for network administrators to handle computer network traffic routing from one part of a controlled network…