A minimalistic file server for JWT-authorized uploads and serving to be used by any web app. Built solely with Caddy plugins.
- Requires git001/caddyv2-upload#15 to be merged
- Test with reverse proxy
xcaddy build --with github.com/ggicci/caddy-jwt --with github.com/git001/caddyv2-upload
The following environment variables are required (can be set using export
):
FILE_TYPE_REGEX
- A regex for the file server to match against, e.g..+\.(png|jpg|webp|pdf)$
AUTH_SIGN_KEY
- The base64-encoded, 32-bytes JWT signing secretAUTH_ISSUERS
- An optional list of allowed issuers (JWT'siss
claim)AUTH_AUDIENCES
- An optional list of allowed audiences (JWT'saud
claim)
./caddy run --config Caddyfile
docker build . -t ghcr.io/muety/mini-filedump
docker run -d \
-p 8000 \
-v /var/data/filedump:/app/uploads \
-e AUTH_SIGN_KEY=dGs4R2tITnZkUUxhY1l4VkJpcFhKUnQ4WHhWdG5rTnAK \
ghcr.io/muety/mini-filedump
curl -XPOST --form @file=some_file.pdf http://localhost:8000
# Response:
# {
# "url": "http://localhost:8000/0d2d7bde-4bd6-442d-b39e-c75bd8065cb2/some_file.pdf
# }