Romain
Romain

Reputation: 809

"Cache-Control: max-age=0" Per-key cache invalidation doesn't do anything

I have an API Gateway and a lambda which query on it. I have set the cache ttl on the API Gateway to the maximum (3600).

I'm testing the API from Postman. My cache is working as querying multiple time the exact same url returns me the result quite fast.

On some conditions, I need the lambda to invalidate the cache for a specific key. So I deactivated "require authorization" under "Per-key cache invalidation" in the API Gateway stage editor, and I'm trying with Postman to do the same query and adding "Cache-Control: max-age=0" header as written here under the "Invalidate an API Gateway Cache Entry" section.

http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-caching.html

However, my cache doesn't seem to empty as querying multiple times is still as fast.

Upvotes: 4

Views: 3428

Answers (2)

Kolodiazhnyi Oleksandr
Kolodiazhnyi Oleksandr

Reputation: 106

Postman silently overrides "Cache-Control" header value to "Cache-Control: no-cache". You are able to see it when press "Code" button. Try to use other tool, curl for instance.

Upvotes: 9

the_karel
the_karel

Reputation: 1434

You can stop Postman sending Cache-Control: no-cache in the settings:

enter image description here

Upvotes: 3

Related Questions