about summary refs log tree commit diff
path: root/README.md
blob: d9d7661f61612e9fed6dfa491914ffd7e3d5274d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
corgi is a CGI server.

[![free of syn](https://img.shields.io/badge/free%20of-syn-hotpink)](https://github.com/fasterthanlime/free-of-syn)

corgi listens on port 26744 by default.

`/etc/corgi.conf`
```
Server
	Port 26744

Script <path-to-cgi-script>
	Match
		Regex <regular-expression>

Script <path-to-cgi-script>
	Environment
		HTTP_HOST <hostname>
		ENV_KEY <some-env-value>
```

See [corgi.conf](corgi.conf) for the configuration I use with my cgit instance.

Scripts are tried in order, looking for one that matches. If none match,
the first script is ran.

Sets the following environmental variables for the CGI script, many following [RFC 3875][rfc]:  
- **`GATEWAY_INTERFACE`** to the fixed value `CGI/1.1`  
- **`PATH_INFO`** to the HTTP path the client requested  
- **`QUERY_STRING`** to the query part of the URI  
- **`REMOTE_ADDR`** is the `Forwarded-For` header, maybe prefixed with
  an `X-`, or the client address if that header is not set  
- **`REQUEST_METHOD`** to the HTTP request method  
- **`SCRIPT_NAME`** is set to the path specified in the config  
- **`SERVER_NAME`** is set to the HTTP host header  
- **`SERVER_PORT`** is the port that corgi is running on  
- **`SERVER_PROTOCOL`** is the HTTP version string that the request came in on  
- **`SERVER_SOFTWARE`** is `corgi/1.0` where `1.0` is the current version number  

Additionally, corgi will set environment variables for the HTTP request headers.
They will be uppercased and hyphens replaced with underscores.

Any environmental variable may be overridden if it is set in the
configuration file.

[rfc]: https://datatracker.ietf.org/doc/html/rfc3875