retstat

Crates.ioretstat
lib.rsretstat
version1.1.1
sourcesrc
created_at2020-05-15 06:17:27.643804
updated_at2020-08-28 23:35:46.297082
descriptionHTTP Server returning the status in the URL
homepage
repositoryhttps://github.com/genuinebyte/retstat
max_upload_size
id241769
size10,904
(gennyble)

documentation

README

retstat

crates.io

This program will return the status code to you. That is, in its HTTP response, the status code you pass in the URL will be used. The body of the response is the default phrasing for that code. If you pass a code that is unknown, "Unknown" will be the body.

retstat was born out of the desire to have a reliable source of status codes so I could test my shell scripts without hitting someone else's server so many times.

I have it live at https://genbyte.dev/status/, so some examples:

There is a very basic service file for systemd in the root of the source tree. It assumes the bin is at /usr/bin/retstat.

Configuration

There isn't much configuration available, as this small server doesn't do much. You can change the listening address with the -l cli option. The long option is --host, if you want to use that.

retstat defaults to listening on localhost:30210.

Below is the recommended configuration for Nginx. Thanks to this answer which taught me how to remove the path the proxy lives under from the path the proxy receives. What I mean is, if you visit https://genbyte.dev/status/200, retstat won't see /status/200 but /200 instead.

location = /status {
	return 302 /status/;
}

location /status/ {
	proxy_pass http://localhost:30210/;
}
Commit count: 0

cargo fmt