You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by Geert Lugtenberg <ge...@poort80.nl> on 2013/01/04 14:52:58 UTC

cache response transformed data

Hi all,

I have a plugin that transforms response data from an origin server at the HTTP_RESPONSE_TRANSFORM hook. As this hook is after the cache write of the response data, my modified data doesn't get written into the cache. How can I write the transformed content to the cache, so that I only have to transform once when there is a cache miss/stale?

Thanks.

Re: cache response transformed data

Posted by Otto van der Schaaf <os...@gmail.com>.
Hi Geert,

If I remember correctly, you can indicate that your transformed content is
cacheable trough
tsapi void TSHttpTxnTransformedRespCache(TSHttpTxn txnp, int on);

You should probably set that flag as early as possible
(read_response_header should be fine).

Regards,

Otto

2013/1/7 Geert Lugtenberg <ge...@poort80.nl>

> Thanks for the response.****
>
> ** **
>
> If you look at the HTTP hooks and transaction diagram here:
> http://trafficserver.apache.org/docs/trunk/sdk/http-hooks-and-transactions/index.en.html
> ****
>
> the cache write takes place before the response transform step right? That
> would explain the behavior I’m getting, because with your advice it’s still
> not caching my transformed content.****
>
> ** **
>
> *From:* Walsh, Peter [mailto:Peter.Walsh@disney.com]
> *Sent:* vrijdag 4 januari 2013 18:22
> *To:* users@trafficserver.apache.org
> *Subject:* Re: cache response transformed data****
>
> ** **
>
> If you register for the TS_HTTP_RESPONSE_TRANSFORM_HOOK while handling the
> event TS_EVENT_HTTP_READ_RESPONSE_HDR, your transformed data will be saved
> to cache.  This will result in the transform only being run when a response
> is from the Origin, and won't be run when its from cache.****
>
> ** **
>
> *From: *Geert Lugtenberg <ge...@poort80.nl>
> *Reply-To: *"users@trafficserver.apache.org" <
> users@trafficserver.apache.org>
> *Date: *Fri, 4 Jan 2013 05:52:58 -0800
> *To: *"users@trafficserver.apache.org" <us...@trafficserver.apache.org>
> *Subject: *cache response transformed data****
>
> ** **
>
> Hi all,****
>
>  ****
>
> I have a plugin that transforms response data from an origin server at the
> HTTP_RESPONSE_TRANSFORM hook. As this hook is after the cache write of the
> response data, my modified data doesn’t get written into the cache. How can
> I write the transformed content to the cache, so that I only have to
> transform once when there is a cache miss/stale?****
>
>  ****
>
> Thanks.****
>

RE: cache response transformed data

Posted by Geert Lugtenberg <ge...@poort80.nl>.
Thanks for the response.

If you look at the HTTP hooks and transaction diagram here: http://trafficserver.apache.org/docs/trunk/sdk/http-hooks-and-transactions/index.en.html
the cache write takes place before the response transform step right? That would explain the behavior I'm getting, because with your advice it's still not caching my transformed content.

From: Walsh, Peter [mailto:Peter.Walsh@disney.com]
Sent: vrijdag 4 januari 2013 18:22
To: users@trafficserver.apache.org
Subject: Re: cache response transformed data

If you register for the TS_HTTP_RESPONSE_TRANSFORM_HOOK while handling the event TS_EVENT_HTTP_READ_RESPONSE_HDR, your transformed data will be saved to cache.  This will result in the transform only being run when a response is from the Origin, and won't be run when its from cache.

From: Geert Lugtenberg <ge...@poort80.nl>>
Reply-To: "users@trafficserver.apache.org<ma...@trafficserver.apache.org>" <us...@trafficserver.apache.org>>
Date: Fri, 4 Jan 2013 05:52:58 -0800
To: "users@trafficserver.apache.org<ma...@trafficserver.apache.org>" <us...@trafficserver.apache.org>>
Subject: cache response transformed data

Hi all,

I have a plugin that transforms response data from an origin server at the HTTP_RESPONSE_TRANSFORM hook. As this hook is after the cache write of the response data, my modified data doesn't get written into the cache. How can I write the transformed content to the cache, so that I only have to transform once when there is a cache miss/stale?

Thanks.

Re: cache response transformed data

Posted by "Walsh, Peter" <Pe...@disney.com>.
If you register for the TS_HTTP_RESPONSE_TRANSFORM_HOOK while handling the event TS_EVENT_HTTP_READ_RESPONSE_HDR, your transformed data will be saved to cache.  This will result in the transform only being run when a response is from the Origin, and won't be run when its from cache.

From: Geert Lugtenberg <ge...@poort80.nl>>
Reply-To: "users@trafficserver.apache.org<ma...@trafficserver.apache.org>" <us...@trafficserver.apache.org>>
Date: Fri, 4 Jan 2013 05:52:58 -0800
To: "users@trafficserver.apache.org<ma...@trafficserver.apache.org>" <us...@trafficserver.apache.org>>
Subject: cache response transformed data

Hi all,

I have a plugin that transforms response data from an origin server at the HTTP_RESPONSE_TRANSFORM hook. As this hook is after the cache write of the response data, my modified data doesn’t get written into the cache. How can I write the transformed content to the cache, so that I only have to transform once when there is a cache miss/stale?

Thanks.