Avoid conditional GET request issue with cache mediator in WSO2 ESB

Gayan Liyanagamage
8 min readFeb 1, 2021

I came across something interesting lately while playing with the WSO2 ESB cache mediator. Since this would be a very common scenario I thought of writing about it. Following is a small description of the problem and the solution.

When a browser sends a request for a certain resource the server replies with the resource with an HTTP ETag value (e.g. ETag: d9537e6b) header. This allows the browser to make conditional requests. The next time the browser sends an HTTP GET request to the same resource it will send a new HTTP header called If-None-Match (e.g. If-None-Match:d9537e6b). The server will only reply with the resource if only the resource has been changed in the server since the last request. This means that the server will only reply with the resource if the ETag value of the requested resource is different from the value sent in the If-None-Match header. Otherwise, the server will reply with an HTTP 304 Not Modified response.

So let’s analyze what happens when we use the cache mediator of the WSO2 ESB. The first time the browser sends a request to the back end service the service will respond and the response will be cached in the ESB. All the subsequent requests sent requesting the same resource will result in the response to be served to the browser from the cache. What happens when the ESB cache is expired? From the second request onwards the browser will add a new “If-None-Match” request to the HTTP request. This will result in the server responding with “HTTP 304 Not Modified” if the resource has not been modified since the last request. This causes the ESB to cache an empty response since the “HTTP 304 Not Modified” does not have a response body.

Let’s consider the following REST API as a sample configuration in the ESB.

<api xmlns="http://ws.apache.org/ns/synapse" name="ArcGIS" context="/GeoCoding">
<resource methods="GET" uri-template="/GeoCode*">
<inSequence>
<property name="POST_TO_URI" value="true" scope="axis2" type="STRING"></property>
<property name="uri.var.format" expression="$ctx:query.param.format" scope="default" type="STRING"></property>
<property name="uri.var.address" expression="$ctx:query.param.address" scope="default" type="STRING"></property>
<log>
<property name="format" expression="get-property('uri.var.format')"></property>
<property name="address" expression="get-property('uri.var.address')"></property>
</log>
<cache id="arcGisSingleCache" scope="per-host" collector="false" hashGenerator="org.wso2.caching.digest.DOMHASHGenerator" timeout="100" maxMessageSize="1000000">
<implementation type="memory" maxSize="1000000"></implementation>
</cache>
<send>
<endpoint>
<http method="get" uri-template="http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find?text={uri.var.address}&f={uri.var.format}"></http>
</endpoint>
</send>
</inSequence>
<outSequence>
<cache id="arcGisSingleCache" scope="per-host" collector="true"></cache>
<log level="full"></log>
<send/>
</outSequence>
</resource>
</api>

We can invoke the above using the SOAP UI or the Advanced REST Client in Google Chrome. Enable wire logs in the ESB to look at the wire level information.

Invoke the API by sending the following request.

http://localhost:8280/GeoCoding/GeoCode?address=seoul&format=json

If you look at the wire logs it will be something similar to the following.

TID: [0] [ESB] [2014-04-29 14:28:51,741] DEBUG {org.apache.synapse.transport.http.wire} - >> "GET /GeoCoding/GeoCode?address=seoul HTTP/1.1[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,741] DEBUG {org.apache.synapse.transport.http.wire} - >> "Host: 162.44.168.228:8280[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,741] DEBUG {org.apache.synapse.transport.http.wire} - >> "Connection: keep-alive[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,742] DEBUG {org.apache.synapse.transport.http.wire} - >> "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,742] DEBUG {org.apache.synapse.transport.http.wire} - >> "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,742] DEBUG {org.apache.synapse.transport.http.wire} - >> "Accept-Encoding: gzip,deflate,sdch[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,742] DEBUG {org.apache.synapse.transport.http.wire} - >> "Accept-Language: en-US,en;q=0.8[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,742] DEBUG {org.apache.synapse.transport.http.wire} - >> "[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,749] INFO {org.apache.synapse.mediators.builtin.LogMediator} - format = json, address = seoul {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-04-29 14:28:51,754] INFO {org.apache.synapse.mediators.builtin.LogMediator} - To: /GeoCoding/GeoCode?address=seoul, MessageID: urn:uuid:773bf9f5-ff71-434e-9d65-807d3cb29b65, Direction: request, Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body></soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-04-29 14:28:51,764] DEBUG {org.apache.synapse.transport.http.wire} - << "GET http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find?text=seoul&f=json HTTP/1.1[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,765] DEBUG {org.apache.synapse.transport.http.wire} - << "Accept-Language: en-US,en;q=0.8[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,765] DEBUG {org.apache.synapse.transport.http.wire} - << "Accept-Encoding: gzip,deflate,sdch[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,765] DEBUG {org.apache.synapse.transport.http.wire} - << "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,766] DEBUG {org.apache.synapse.transport.http.wire} - << "Host: geocode.arcgis.com:80[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,766] DEBUG {org.apache.synapse.transport.http.wire} - << "Connection: Keep-Alive[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,766] DEBUG {org.apache.synapse.transport.http.wire} - << "User-Agent: Synapse-PT-HttpComponents-NIO[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,767] DEBUG {org.apache.synapse.transport.http.wire} - << "[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,164] DEBUG {org.apache.synapse.transport.http.wire} - >> "HTTP/1.1 200 OK[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,164] DEBUG {org.apache.synapse.transport.http.wire} - >> "Via: 1.1 CDTSTMG02[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,164] DEBUG {org.apache.synapse.transport.http.wire} - >> "Connection: Keep-Alive[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,165] DEBUG {org.apache.synapse.transport.http.wire} - >> "Proxy-Connection: Keep-Alive[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,165] DEBUG {org.apache.synapse.transport.http.wire} - >> "Transfer-Encoding: chunked[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,165] DEBUG {org.apache.synapse.transport.http.wire} - >> "Date: Tue, 29 Apr 2014 18:28:52 GMT[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,165] DEBUG {org.apache.synapse.transport.http.wire} - >> "Content-Type: text/plain;charset=utf-8[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,165] DEBUG {org.apache.synapse.transport.http.wire} - >> "ETag: d9537e6b[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,166] DEBUG {org.apache.synapse.transport.http.wire} - >> "Server: [\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,166] DEBUG {org.apache.synapse.transport.http.wire} - >> "Cache-Control: max-age=0,must-revalidate[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,166] DEBUG {org.apache.synapse.transport.http.wire} - >> "Set-Cookie: AGS_ROLES="419jqfa+uOZgYod4xPOQ8Q=="; Version=1; Max-Age=60; Expires=Tue, 29-Apr-2014 18:30:02 GMT; Path=/arcgis/rest; HttpOnly[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,166] DEBUG {org.apache.synapse.transport.http.wire} - >> "[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,168] DEBUG {org.apache.synapse.transport.http.wire} - >> "143[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,168] DEBUG {org.apache.synapse.transport.http.wire} - >> "{"spatialReference":{"wkid":4326,"latestWkid":4326},"locations":[{"name":"Seoul, Seoul, South Korea","extent":{"xmin":126.85532000000001,"ymin":37.456209999999999,"xmax":127.1934,"ymax":37.705689999999997},"feature":{"geometry":{"x":126.97782765600061,"y":37.56825582300047},"attributes":{"Score":100,"Addr_Type":"POI"}}}]}[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,168] DEBUG {org.apache.synapse.transport.http.wire} - >> "0[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,168] DEBUG {org.apache.synapse.transport.http.wire} - >> "[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,207] INFO {org.apache.synapse.mediators.builtin.LogMediator} - GEO API = RESPONSE {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-04-29 14:28:52,209] INFO {org.apache.synapse.mediators.builtin.LogMediator} - To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:4a2d34ea-cf46-4e4e-8bec-aee1a3936c3b, Direction: response, MESSAGE = INCOMING, Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><text xmlns="http://ws.apache.org/commons/ns/payload">{"spatialReference":{"wkid":4326,"latestWkid":4326},"locations":[{"name":"Seoul, Seoul, South Korea","extent":{"xmin":126.85532000000001,"ymin":37.456209999999999,"xmax":127.1934,"ymax":37.705689999999997},"feature":{"geometry":{"x":126.97782765600061,"y":37.56825582300047},"attributes":{"Score":100,"Addr_Type":"POI"}}}]}</text></soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}

Notice the “ETag: d9537e6b” header sent with the response. After some time when the cache cache expires if we send another request to the ESB the logs would look like the following. (Since we are using the SOAP UI or the Advanced REST Client please add a new “If-None-Match:d9537e6b” HTTP header to simulate the browser behavior).

TID: [0] [ESB] [2014-04-29 14:29:10,610] DEBUG {org.apache.synapse.transport.http.wire} - >> "GET /GeoCoding/GeoCode?address=seoul HTTP/1.1[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,610] DEBUG {org.apache.synapse.transport.http.wire} - >> "Host: 162.44.168.228:8280[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,610] DEBUG {org.apache.synapse.transport.http.wire} - >> "Connection: keep-alive[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,611] DEBUG {org.apache.synapse.transport.http.wire} - >> "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,611] DEBUG {org.apache.synapse.transport.http.wire} - >> "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,611] DEBUG {org.apache.synapse.transport.http.wire} - >> "Accept-Encoding: gzip,deflate,sdch[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,611] DEBUG {org.apache.synapse.transport.http.wire} - >> "Accept-Language: en-US,en;q=0.8[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,611] DEBUG {org.apache.synapse.transport.http.wire} - >> "If-None-Match: d9537e6b[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,612] DEBUG {org.apache.synapse.transport.http.wire} - >> "[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,625] INFO {org.apache.synapse.mediators.builtin.LogMediator} - format = json, address = colombo {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-04-29 14:29:10,629] INFO {org.apache.synapse.mediators.builtin.LogMediator} - To: /GeoCoding/GeoCode?address=colombo, MessageID: urn:uuid:a784dda4-faa5-4a82-8758-111f4b8cd330, Direction: request, Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body></soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-04-29 14:29:10,636] DEBUG {org.apache.synapse.transport.http.wire} - << "GET http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find?text=colombo&f=json HTTP/1.1[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,637] DEBUG {org.apache.synapse.transport.http.wire} - << "Accept-Language: en-US,en;q=0.8[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,637] DEBUG {org.apache.synapse.transport.http.wire} - << "Accept-Encoding: gzip,deflate,sdch[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,637] DEBUG {org.apache.synapse.transport.http.wire} - << "If-None-Match: d9537e6b[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,637] DEBUG {org.apache.synapse.transport.http.wire} - << "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,637] DEBUG {org.apache.synapse.transport.http.wire} - << "Host: geocode.arcgis.com:80[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,637] DEBUG {org.apache.synapse.transport.http.wire} - << "Connection: Keep-Alive[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,637] DEBUG {org.apache.synapse.transport.http.wire} - << "User-Agent: Synapse-PT-HttpComponents-NIO[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,638] DEBUG {org.apache.synapse.transport.http.wire} - << "[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,973] DEBUG {org.apache.synapse.transport.http.wire} - >> "HTTP/1.1 304 Not Modified[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,974] DEBUG {org.apache.synapse.transport.http.wire} - >> "Via: 1.1 CDTSTMG02[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,974] DEBUG {org.apache.synapse.transport.http.wire} - >> "Connection: Keep-Alive[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,974] DEBUG {org.apache.synapse.transport.http.wire} - >> "Proxy-Connection: Keep-Alive[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,975] DEBUG {org.apache.synapse.transport.http.wire} - >> "Date: Tue, 29 Apr 2014 18:29:10 GMT[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,975] DEBUG {org.apache.synapse.transport.http.wire} - >> "Age: 0[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,975] DEBUG {org.apache.synapse.transport.http.wire} - >> "[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,983] INFO {org.apache.synapse.mediators.builtin.LogMediator} - GEO API = RESPONSE {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-04-29 14:29:10,984] INFO {org.apache.synapse.mediators.builtin.LogMediator} - To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:d79666e6-b6e1-4ccd-972c-a8cac419e1ef, Direction: response, MESSAGE = INCOMING, Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body></soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-04-29 14:29:10,989] DEBUG {org.apache.synapse.transport.http.wire} - << "HTTP/1.1 304 Not Modified[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,989] DEBUG {org.apache.synapse.transport.http.wire} - << "Age: 0[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,989] DEBUG {org.apache.synapse.transport.http.wire} - << "Via: 1.1 CDTSTMG02[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,989] DEBUG {org.apache.synapse.transport.http.wire} - << "Content-Type: application/xml[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,990] DEBUG {org.apache.synapse.transport.http.wire} - << "Proxy-Connection: Keep-Alive[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,990] DEBUG {org.apache.synapse.transport.http.wire} - << "Date: Tue, 29 Apr 2014 18:29:10 GMT[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,990] DEBUG {org.apache.synapse.transport.http.wire} - << "Server: WSO2-PassThrough-HTTP[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,990] DEBUG {org.apache.synapse.transport.http.wire} - << "Transfer-Encoding: chunked[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,990] DEBUG {org.apache.synapse.transport.http.wire} - << "Connection: keep-alive[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,990] DEBUG {org.apache.synapse.transport.http.wire} - << "[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,991] DEBUG {org.apache.synapse.transport.http.wire} - << "0[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,991] DEBUG {org.apache.synapse.transport.http.wire} - << "[\r][\n]" {org.apache.synapse.transport.http.wire}

You can see that the ESB is sending the request to the back end service with the “If-None-Match” header and the server has replied with an “HTTP/1.1 304 Not Modified” with an empty response body. This now gets cached in the ESB. All the similar subsequent requests will result in an empty response retrieved from the cache.

So how to avoid this from happening?

The answer is very simple. We may drop an “If-None-Match” header if there is any when we send it to the back end server. We can use the header mediator to achieve this before the cache mediator.

<header name="If-None-Match" scope="transport" action="remove"/><cache id=”arcGisSingleCache”
scope=”per-host”
collector=”false”
hashGenerator=”org.wso2.caching.digest.DOMHASHGenerator”
timeout=”60″
maxMessageSize=”1000000″>
<implementation type=”memory” maxSize=”1000000″/>

This will cause the back end server to treat the incoming request as a new request which does not know anything about the requested resource. Hence the server will always reply with the correct response having a body and it will be cached in the ESB so that all the requests will be served with the correct resource.

Hope this will be helpful.

--

--