Hi All, I need to get the cached response fetched time from origin server which is returned in the BE response with Date header. When I debugged the cache-mediator code, I found that when caching the response Date header is added to the cache. But when I retrieve the cached response for the subsequent request, Date header is removed from the cached response.
This is due to we are removing the Date header from the response [1] and send a new Date header with the response to the user. If we set the preserveHeaders(in passthru-http.properties), I was able to get the Date header from the cached response as well. So, as I need the response fetched time to calculate the TTL value of the cached response, I am planning to add a property to the cached response to store the fetched time and use it to calculate the TTL. Or do we need to suggest the user to set the preserve header? [1]. https://github.com/wso2/wso2-synapse/blob/master/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/util/PassThroughTransportUtils.java#L160 Thanks, Keerthika. On Tue, Jan 23, 2018 at 8:26 PM, Keerthika Mahendralingam < [email protected]> wrote: > Hi All, > > I am trying to add an Age header when returning the cached response(as > discussed in [1]). I am following the steps as follows: > > - If the response doesn't have the Date header, add Date header (with > current time) when caching the response[2]. > - For the subsequent request, get the Date header value of the cached > response, timeout and current requested time and find the TTL value as: > > TTL = difference ((DateHeaderValue + timeout), CurrentTime) > > > - Set the TTL value as Age header. > > Please let me know if you have any concerns on this. > > [1]. [Architecture][RRT] Improving caching based on cache-control and ETag > headers > [2]. https://tools.ietf.org/html/rfc2616#page-124 > > Thanks, > Keerthika. > -- > <[email protected]> > Keerthika Mahendralingam > Software Engineer > Mobile :+94 (0) 776 121144 <+94%2077%20612%201144> > [email protected] > WSO2, Inc. > lean . enterprise . middleware > -- <[email protected]> Keerthika Mahendralingam Software Engineer Mobile :+94 (0) 776 121144 [email protected] WSO2, Inc. lean . enterprise . middleware
_______________________________________________ Architecture mailing list [email protected] https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
