Amazon CloudFront
Developer Guide (API Version 2016-09-29)

Accessing the Request Body by Choosing the Include Body Option

You can opt to have Lambda@Edge expose the body in a request for writable HTTP methods (POST, PUT, DELETE, and so on), so that you can access it in your Lambda function. You can choose read-only access, or you can specify that you’ll replace the body.

To enable this option, choose Include Body when you create a CloudFront trigger for your function that's for a viewer request or origin request event. For more information, see Adding Triggers for a Lambda@Edge Function, or to learn about using Include Body with your function, see Lambda@Edge Event Structure.

Scenarios when you might want to use this feature include the following:

  • Processing web forms, like "contact us" forms, without sending customer input data back to origin servers.

  • Gathering web beacon data that's sent by viewer browsers and processing it at the edge.

For sample code, see Lambda@Edge Example Functions.


If the request body is large, Lambda@Edge truncates it. For detailed information about size limits and truncation, see Size Limits for Body with the Include Body Option.