req.body

STRING, read-only.

Available inall subroutines.

The request body. Using this variable for binary data will truncate at the first null character. Limited to 8KB in size.

Exceeding the limit results in the req.body variable being blank, which returns a not set value. If this happens it can be detected with the following VCL:

if (std.atoi(req.http.Content-Length) > 0 && std.strlen(req.body) == 0 && req.method == "POST") {
// Body has been truncated
}

The variable req.postbody is an alias for req.body.

User contributed notes

BETA

Do you see an error in this page? Do you have an interesting use case, example or edge case people should know about? Share your knowledge and help people who are reading this page! (Comments are moderated; for support, please contact Fastly support)