35 lines
1.4 KiB
Caddyfile
35 lines
1.4 KiB
Caddyfile
# Serves the paperspec website built by `python3 tools/site.py` (the `_site/` folder), copied to /srv/www/paperspec.
|
|
# The site mirrors the repository, so every schema is served at its $id and the JSON-LD context at the address
|
|
# layers name; this file sets the media types those addresses need and lets any page fetch them.
|
|
paperspec.scient.ing {
|
|
root * /srv/www/paperspec
|
|
encode zstd gzip
|
|
|
|
# Every file may be fetched from any origin: JSON-LD processors and schema validators in browsers need it.
|
|
header Access-Control-Allow-Origin "*"
|
|
header X-Content-Type-Options "nosniff"
|
|
|
|
# file_server keeps a Content-Type that is already set, so these take precedence over its defaults.
|
|
@jsonld path *.jsonld
|
|
header @jsonld Content-Type "application/ld+json"
|
|
@schema path /schemas/*.schema.json
|
|
header @schema Content-Type "application/schema+json"
|
|
@jsonl path *.jsonl
|
|
header @jsonl Content-Type "application/jsonl; charset=utf-8"
|
|
@package path *.sct.zip
|
|
header @package Content-Type "application/vnd.scienting.doc+zip"
|
|
@text path *.md *.py *.sql *.csv *.hex *.toml *.lock *.txt
|
|
header @text Content-Type "text/plain; charset=utf-8"
|
|
|
|
# Pages and the search index change with each release; data files are cached briefly too, since the
|
|
# addresses stay the same across releases while their contents may not.
|
|
header Cache-Control "public, max-age=300"
|
|
|
|
file_server
|
|
|
|
handle_errors {
|
|
rewrite * /404.html
|
|
file_server
|
|
}
|
|
}
|