Search code examples
cachingwso2wso2-enterprise-integratorwso2-micro-integratorwso2-esb

Cache mediator is not working when I hit the services via postman - WSO2 - MI


I am using a cache mediator inside the proxy, that proxy I am calling the inside sequence(I need to use cache into several API that's why I am calling that proxy inside sequence). then I am calling into the rest API.

Issue: when I am hitting the rest API services through postman, cache is not working.

the same services I am hitting from SoapUI, cache is working fine(second time onwards the response is coming from cache storage).

it's chrome also it's working.


Solution

  • I believe Postman sends a random token in every request. Postman-Token: <Token>. Cache mediator works by checking the headers and payload of the request. When a random header value is sent every time, cache mediator will diagnose it as a different request. Hence the response won't be served from the Cache.

    To overcome the issue add the "Postman-Token" header in the cache mediator configuration under <headersToExcludeInHash/>

    https://docs.wso2.com/display/EI660/Cache+Mediator