How we use Amazon CloudFront for dynamically generated content
There are well documented requirements to the resources Amazon CloudFront will cache. For our use-case most interesting HTTP headers would be the Cache-Control, Date, Last-Modified and ETag.
Amazon CloudFront uses Cache-Control header to control how long it should cache given resource. There is another Expires header available in the HTTP spec, however Cache-Control is preferred by CloudFront.
Apart from that we need to serve Date and Last-Modified headers that are required to compute expire value from Cache-Control header.