'Counting cloudfront cache hits

We have a REST API served by a Python web server, and we use AWS CloudFront to cache it in order to increase performance.

This API is non-deterministic: it generates a UUID and returns it as part of the response. Because of the CloudFront cache, this API may return duplicated UUIDs.

Having duplicated UUIDs is problematic in other parts of our system. Also, our customer (who develops the client of this API) doesn't want to generate this UUID on his side.

Is there a way to count calls to the API on the server-side?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source