I have a CloudFront distribution set up so that <domain>/api
redirects me to <api-gateway-url>/<env>/api
. However I find that sometimes CloudFront caches responses to GET requests and the browser does not redirect to the API Gateway endpoint and returns the cached response.
Example: /api/getNumber
redirects to <api-gateway-url>/<env>/api/getNumber
and returns me 2. I change the response so that it should return the number 300, but when I make a request through my browser now there is no redirect and I still get back the number two. The x-cache
response header says cache hit from CloudFront.