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

Event Structure

The following is an example of a request event. Headers, URI, and client IP are available within the event as follows:

Request Event:

{
"Records":[
          {
              "cf": {
                  "configuration": {
                      "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"]
                      }
                  }
              }
          }
      ]
}

Response Event:

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

Request Event

  • Uri (read/write): Relative path of the content that is being requested from CloudFront. Updating this field changes the content that is being served.

  • 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.

Response Event

  • 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.