Edge
originRequest : (OriginRequest -> flags -> OutputEvent) -> flags -> Maybe InputOrigin -> OutputEvent
Handler for origin request events
originRequest
(\{ request } flags ->
{ request | uri = "new-uri" }
|> toRequest
)
originResponse : (OriginResponse -> flags -> OutputEvent) -> flags -> Maybe InputOrigin -> OutputEvent
Handler for origin response events
originResponse
(\{ response, request } _ ->
response
|> withHeader
{ key = "cache-control", value = "public, max-age=31536000" }
|> toResponse
)
toRequest : Request -> OutputEvent
Map request to output event, to be used with originRequest
or originResponse
toResponse : Response -> OutputEvent
Map response to output event, to be used with originResponse
Types for the lambda event structure.
{ records : List Record }
{ cf : InputOrigin }
{ config : Config
, request : Request
, response : Response
}
{ config : Config
, request : Request
}
{ distributionDomainName : String
, distributionId : String
, eventType : String
, requestId : String
}
{ clientIp : String
, headers : CloudFront.Header.Headers
, method : String
, origin : Origin
, querystring : Maybe String
, uri : String
}
{ status : String
, statusDescription : String
, headers : CloudFront.Header.Headers
}
{ s3 : S3OriginData }
{ authMethod : String
, customHeaders : CloudFront.Header.Headers
, domainName : String
, path : String
, region : String
}
{ custom : CustomOriginData }
{ customHeaders : CloudFront.Header.Headers
, domainName : String
, keepaliveTimeout : Basics.Int
, path : String
, port_ : Basics.Int
, protocol : String
, readTimeout : Basics.Int
, sslProtocols : List String
}