Skip to content

Regression: Caddy 2.9.0 returns 411 Length Required for some sites #6757

@spurgeonbj

Description

@spurgeonbj

After upgrading from Caddy 2.8.4 to 2.9.0, Joomla sites started returning HTTP 411 ("Length Required") errors for certain requests. Downgrading to Caddy 2.8.4 resolves the issue, indicating a regression or stricter enforcement of request header handling in 2.9.0.

The problem seems related to:

  1. Handling of requests without a Content-Length header.

. Requests that were previously allowed in Caddy 2.8.4 now fail in 2.9.0.

  1. Interaction with Joomla's rewrites.

. Joomla relies on rewrites for dynamic routing (e.g., /index.php?{query}). The rewrites still work, but certain requests (possibly POST or other non-GET methods) fail with 411.

Steps to Reproduce:

Configure a Joomla site with the following minimal Caddyfile:

example.com {
    root * /var/www/samplesite
    php_fastcgi unix//run/php/php7.4-fpm.sock
    file_server

    @joomlaNotFound {
        not file {path}
        not file {path}/index.php
    }
    rewrite @joomlaNotFound /index.php?{query}
}

Make a POST request without a Content-Length header:

curl -X POST https://dev.apcwo.org/path -d '' -v

Observe a 411 response in Caddy 2.9.0. The same configuration works in Caddy 2.8.4.

Expected Behavior: Caddy should handle requests without a Content-Length header the same way as in version 2.8.4 or provide clear guidance on how to adapt the configuration.

Observed Behavior: Caddy 2.9.0 returns 411 errors for requests that worked in 2.8.4, breaking Joomla functionality.

Additional Details:

Joomla uses rewrites heavily, and the issue seems tied to how Caddy processes requests during rewrites.
The problem was tested with PHP-FPM and occurs even with minimal configurations.
Caddy logs show no additional details besides the 411 response.
Downgrading to Caddy 2.8.4 immediately resolves the issue.

Environment:

Caddy Version: 2.9.0
PHP Version: 7.4 (PHP-FPM)
Joomla Version: (3.10)
OS: (Ubuntu 20.04)

Suggestions for Debugging:

Review changes in Caddy 2.9.0 related to request handling or HTTP compliance.
Investigate interactions between the rewrite directive and PHP-FPM.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐞Something isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions