Serve ANSI, ASCII & BBS art
Below is a barebones configuration using Caddy to only to serve files using the URL example.com/ansi/
.
The served textfiles are located at /var/www/example.com/html
.
Caddyfile | |
---|---|
The encode
directive compresses the served files using the Zstandard and Gzip algorithms to reduce the file size and speed up the text file downloads.
The handle_path
directive applies the configuration to all files using the path /ansi/*
.
The root
paired with the file_server
directive sets the (virtual) root directory to /var/www/example.com/html/ansi
.
header {
Content-Type "text/plain; charset=iso-8859-1"
X-Content-Type-Options nosniff
}
The header
directive combined with the Content-Type "text/plain; charset=iso-8859-1"
block adds a response header to tell the browser to treat the file as plain text encoded as ISO-8859-1, a legacy character set RetroTxt can understand. You cannot use CP-437 or other DOS code pages as they are not valid browser encodings.
The X-Content-Type-Options nosniff
directive adds the response header to tell browsers not to sniff the content. MIME sniffing often inaccurately treats ANSI and other encoded text as binary files browsers download.