Limit space with webdav

1. Output of caddy version:

v2.6.2

2. How I run Caddy:

as a webdav server

a. System environment:

ubuntu 22

d. My complete Caddy config:

{
    order webdav last
}

dav.atest.com {
    root * /local/test
    basicauth {
        user1 $2a$14$SJ1Fe4jVLVyltVnSgJbp5.SlYjaw6WXmtrZcZjepD7h/qWwZluPwS
    }
    webdav
}


3. The problem I’m having:

Is it possible to limit the size of the folder (kind of a quota) when uploading files using webdav ?

Is it possible to have Caddy only serve .HTML, .JPEG and .PNG by excluding every other file extension ?

You can limit the size of an uploaded file with request_body (Caddyfile directive) — Caddy Documentation which limits the request body to a maximum size.

You can use path matchers to only allow specific requests by file extension, by rejecting anything that does not match:

@disallowed not path / *.html *.jpg *.jpeg *.png
error @disallowed 404

The / is to allow requests to the root of your site, otherwise that would throw an error as well. You might need to allow .css and .js if you’re trying to serve a website with this, FYI.

2 Likes

that’s great thank you!!

2 Likes