I tested APIM performance with API Response cache. The result was a little different to my expectation. like below.
The first API reqeust got the 404 response status code from API Service through API Gateway. So I expected the second response would be 404 response status code from API Response cache. However it returned 200 response status code (different to the first) with same response body.
I read some note like below from WSO2 document.
Cache mediator does not cache the response status code of the HTTP response in the cache table. Instead, it returns the "200 OK" status code on a cache hit, which is the default request success status response. If you want to return a different status code when the request gets a cache hit, you can update the response status code in the onCacheHit sequence.
I understood what means the note, but I have no idea how to do that. It's not my area working with cache mediation, especially mediation syntax.
I want API Response cache to work with HTTP Response status code. Can somebody guide for me?