caddyv2-upload

This repo holds a simple caddyserver v2 upload handler

Warning
You have to secure the upload URL as the nature of this handler/plugin is to save uploaded artifacts on the disc.

In this handler are the following modules in use.

  • templates

  • file_server

  • github.com/caddyserver/jsonc-adapter

  • upload 🙂

config

Because I prefer the JSON Config will I write here the config only in JSON Syntax.

                {
                  "handler": "upload",
                  "dest_dir": "tmp-upl",   # (1)
                  "max_filesize": 2048,    # (2)
                  "response_template":"upload-resp-template.txt" # (3)
                },
  1. Destination Directory on the Server site

  2. Maximal possible upload size

  3. the response template which will be used for respose after upload

A full working example is in docker-files/opt/webroot/config/Caddyfile-upload.json

build

---
xcaddy build --with github.com/kirsch33/realip \
  --with github.com/caddyserver/jsonc-adapter \
  --with github.com/git001/caddyv2-upload
---

run

cli

---
APPPORT=:2011 ./caddy run \
  -adapter jsonc \
  -config Caddyfile-upload.json
---

docker

You can get this image from docker hub

The default listen port is defined with this variable

APPPORT=:2011

---
podman run --rm docker.io/me2digital/caddyv2-upload:0.1
# or
docker run --rm docker.io/me2digital/caddyv2-upload:0.1
---

GitHub

View Github