Name

reply_body_max_size

Synopsis

This directive allows you to limit the size of HTTP reply bodies based on ACL elements. When a request matches one of the reply_body_max_size rules, Squid places a limit on the size of the HTTP response. A value of 0 indicates no limit. Squid checks the reply size first when all HTTP headers have been received. If the headers contain a Content-Length value that exceeds the specified limit, the user receives a message that states “the request or reply is too large.” If the content length is unavailable, Squid continues checking the limit as data comes in from the server. If the reply size exceeds the limit, Squid closes the client’s connection, which causes the client to receive a partial reply.

Downstream caches often can’t detect partial replies. Because the headers lack a content length value, the downstream cache (or user-agent) doesn’t know that additional data is missing. Thus, you shouldn’t use reply_body_max_size if you have child or sibling caches.

The code that checks the reply_body_max_size list ignores deny rules. In other words, it is pointless to include deny rules in this list.

Make sure that the maximum reply size is large enough for a Squid error message (typically 1K-2K bytes). An error message that is larger than the maximum reply body size causes Squid to crash.

Syntax

reply_body_max_size bytes allow [!]ACLname ...

Default

reply_body_max_size 0 allow all

Example

acl WorkingHours time 08:00-17:00 reply_body_max_size 10485760 allow WorkingHours ...

Get Squid: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.