Common Gateway Interface

The official CGI logo from the spec announcement

In computing, Common Gateway Interface (CGI) is an interface specification that enables web servers to execute an external program to process HTTP or HTTPS user requests.

Such programs are often written in a scripting language and are commonly referred to as CGI scripts, but they may include compiled programs.[1]

A typical use case occurs when a web user submits a web form on a web page that uses CGI. The form's data is sent to the web server within an HTTP request with a URL denoting a CGI script. The web server then launches the CGI script in a new computer process, passing the form data to it. The CGI script passes its output, usually in the form of HTML, to the Web server, and the server relays it back to the browser as its response to the browser's request.[2]

Developed in the early 1990s, CGI was the earliest common method available that allowed a web page to be interactive. Due to a necessity to run CGI scripts in a separate process every time the request comes in from a client, various alternatives were developed.

  1. ^ Robinson <[email protected]>, David (2004). "The Common Gateway Interface (CGI) Version 1.1". tools.ietf.org. doi:10.17487/RFC3875. Archived from the original on 11 February 2007. Retrieved 16 February 2021.
  2. ^ Robinson, D.; Coar, K. (2004). "RFC3875: The Common Gateway Interface (CGI) Version 1.1". doi:10.17487/RFC3875. Archived from the original on 19 April 2021. Retrieved 25 February 2012. {{cite journal}}: Cite journal requires |journal= (help)