Can not upload Large file to CaddyServer show '(failed)net::ERR_CONNECTION_RESET' after 3minutes

1. The problem I’m having:

Can not upload Large file to CaddyServer show ‘(failed)net::ERR_CONNECTION_RESET’ after 3minutes.
my file size 300mb +. But when upload low size (40mb±) then work. I identify that when I upload large file then it fail after 3 minutes.

2. Error messages and/or full log output:

I checked caddy log but no issue found. following message from browser request error message👇

(failed)net::ERR_CONNECTION_RESET

3. Caddy version:

v2.6.4 h1:2hwYqiRwk1tf3VruhMpLcYTg+11fCdr8S3jhNAdnPy8=

4. How I installed and ran Caddy:

I have run caddy as usual. already running many web app through caddy. This app also running but when I upload large file then issue occur.

a. System environment:

Distributor ID: Ubuntu
Description: Ubuntu 22.04.1 LTS
Release: 22.04
Codename: jammy

b. Command:

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

c. Service/unit/compose file:

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

d. My complete Caddy config:


m.besnik.net {
        root * /var/www/m.besnik.net/public

        # Provide Zstd and Gzip compression
        encode zstd gzip

        # Enable PHP-FPM
        # Change this based on installed php version
        php_fastcgi unix//run/php/php8.1-fpm.sock

        # Allow caddy to serve static files
        file_server
	
	log {
           output file /var/log/caddy/flowgiri.access.log
         }

        @static {
                file
                path *.ico *.css *.js *.gif *.jpg *.jpeg *.png *.svg *.woff *.pdf *.webp
        }

        header @static Cache-Control max-age=5184000
}

5. Links to relevant resources:

I have checked many question on community but did not find solution.

I also not found any alternative to timeouts directive in caddy 2. I have checked with request_body { max_size 800MB } but same issue.

Also check with timeouts none but shoe unrecognized directive: timeouts

The issue is actually coming from PHP, not Caddy, which rejects large files. This is configured in php.ini. I’m not a PHP dev, so I don’t know the nuances of those configuration options.

I already change those :

max_execution_time	10000	10000
upload_max_filesize	800M	800M
post_max_size	800M	800M
max_execution_time	10000	10000

but same issue exist.

Finally identified it was block large file upload by cloudflire

Issue resolved😃

Here is the Limit of Cloudflire:

100MB Free and Pro
200MB Business
500MB Enterprise by default

Thank you :pray:

1 Like

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