Caddyfile equivalent of nginx's "client_max_body_size"

1. Caddy version (caddy version):


2. How I run Caddy:

a. System environment:


b. Command:

caddy run --config /dockerapp/caddy/Caddyfile

c. Service/unit/compose file:

d. My complete Caddyfile or JSON config:

  storage redis {
    host {$REDIS_HOST}
  on_demand_tls {
    interval 2m
    burst 5

(SecurityHeaders) {
  header_up X-Real-IP {remote_host}
  header_up X-Forwarded-Proto {scheme}
}, * {

    @notStatic {
        not file
    reverse_proxy @notStatic web:3000
    log {
        # format single_field common_log
        output file /data/logs/caddy.log
    tls {
        dns route53

:443, :80 {
    tls {

3. The problem I’m having:

Thank you for all your work on Caddy, it’s been great to work with it! I’m migrating over from nginx and there’s one configuration I haven’t been able to add to my Caddyfile:

client_max_body_size which lets you limit the file size of an upload.

There appears to be a way to do it with a JSON, but in this thread it says there wasn’t a way to do it with Caddyfile as of May 2020. File upload size limits

I’d prefer to stick with the Caddyfile format since I’ve spent a lot of time learning this format, and was hoping to use this module without switching to JSON format. Is there a way to accomplish this now?

4. Error messages and/or full log output:

5. What I already tried:

I tried adding the directives directly into reverse_proxy Caddyfile directive, with no luck.

6. Links to relevant resources:

Yup, it’s right here:

It’s a directive, like reverse_proxy, so it goes beside it, not inside it.

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.