Modify Cached object

Asked by SarnavaMukherjee on 2019-04-25

I am using squid & ecap for content adaptation/modification both for request & response.

Requirement:
Modify object that has already been cached in squid.

Example:
If I have a gzip compressed object in cache and we have a new request for uncompressed
data, I want to decompress the cached object (qzip encoded) and serve the request

How can I achieve this?

Question information

Language:
English Edit question
Status:
Answered
For:
eCAP Edit question
Assignee:
No assignee Edit question
Last query:
2019-04-25
Last reply:
2019-04-25
Alex Rousskov (rousskov) said : #1

To adapt cache hit responses, the host application has to support post-cache adaptation. Most host applications, including Squid, do not support post-cache adaptation. One could, of course, add that support to Squid, but it is a huge project largely unrelated to eCAP.

Here is the best workaround I can think of right now: You could use your pre-cache REQMOD adapter to satisfy the request for the uncompressed version of the object (i.e. generate the desired response in REQMOD). Your REQMOD adapter would need access to the host application cache. eCAP itself does not provide such access, but, the adapter could request the compressed object from the host application using its regular HTTP interface. In other words, the REQMOD adapter will send an HTTP request for the compressed version to the proxy and decompress the response on-the-fly, satisfying the second request.

One of the workaround drawbacks is that the uncompressed version will not be cached by the host application: Another request for uncompressed content will again necessitate asking the host application for the compressed version and decompressing it on the fly. It may be possible to overcome this by generating another HTTP transaction from the REQMOD adapter, the one that would reach RESPMOD adapter this time, but it gets even more complicated/tricky.

Can you help with this problem?

Provide an answer of your own, or ask SarnavaMukherjee for more information if necessary.

To post a message you must log in.