How do I set the cache key for the AWS API Gateway?


I have a Lambda function that is mapped to a HTTP endpoint using the AWS API Gateway. This works fine, I have mapped query string params to the Lambda event, everything works:

Which I can call from

I would like to enable caching, but it seems that by default the API Gateway uses the URL for caching, and so changes in my query string parameters are not triggering a different cache result.

The result is that with caching on, my page returns whatever data was first requested and put in the cache.

How do I set a custom cache key or ensure querystring is part of the cache identifier?


Turns out the is a not-so-secret setting that I totally missed that allows for the exact query string params that should be used for the cache to be set.

Set Cache for URL Query String Params

Leave a Reply