DianaIonita / serverless-api-gateway-caching

A plugin for the Serverless framework which helps with configuring caching for API Gateway endpoints.
ISC License
136 stars 35 forks source link

Is there a way to cache the whole query string? #88

Closed GustavoMS97 closed 3 years ago

GustavoMS97 commented 3 years ago

I know that there is a way to cache the path using this configuration:

`cacheKeyParameters:

Is there a way to do the same with the query string? instead of naming the fields, because i have dynamic filters, i need it to be dynamic.

DianaIonita commented 3 years ago

Hi @GustavoMS97,

Thanks for your question. Caching based on query strings where you don't know all the names of the parameters in advance doesn't seem to be supported by API Gateway. I found an AWS Forum post with a similar question, where someone from AWS mentioned that they may bring in support, but there isn't an ETA for that. They also suggested a workaround:

There's no way to set parameters unknown to API Gateway as cache keys. If restructuring your request url is an option you can provide list of column names as a single parameter value instead of each column being a parameter name. This way every request with different set of columns will have its own cache key.

Hope this helps.