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

Event Structure

The following example shows a request event.

Request Event

Copy
{ "Records":[ { "cf": { "config": { "distributionId": "EXAMPLE" }, "request": { "uri": "/me.pic", "method": "GET", "httpVersion": "2.0", "clientIp": "2001:cdba::3257:9652", "headers": { "User-Agent": ["Test Agent"], "Host" : ["d2fadu0nynjpfn.cloudfront.net"] } } } } ] }

The headers, URI, and client IP are available within the event as follows:

  • Uri (read/write): Relative path of the content that is being requested from CloudFront. Updating this field changes the content that is being served. If you update this field, the new relative path must begin with an "/".

  • method (read-only): HTTP method of the incoming request.

  • httpVersion (read-only): HTTP version of the incoming request.

  • clientIp (read-only): Client IP for the incoming request.

  • Headers (read/write): An object that represents the headers of the incoming request. Each header is represented as an array of values. For information about restrictions on header usage, see Header Restrictions.

The following example shows a response event:

Response Event

Copy
{ "Records":[ { "cf": { "config": { "distributionId": "EDFDVBD6EXAMPLE " }, "response": { "status": "200", "statusDescription": "HTTP OK", "httpVersion": "2.0", "headers": { "User-agent": [ "mozilla", "safari" ], "Vary": [ "*" ] } } } } ] }

The status, status description, httpVersion, and headers are available within the event as follows:

  • Status (read-only): HTTP status code that is served to clients.

  • statusDescription (read-only): HTTP status that is served to clients.

  • httpVersion (read-only): HTTP version of the outgoing HTTP response.

  • Headers (read/write): An object that represents the headers of the outgoing response. Each header is represented as an array of values. For information about restrictions on header usage, see Header Restrictions.