Thank you so much. After all i've got what I want.

-----Original Message-----
From: Leif Hedstrom [mailto:zw...@apache.org] 
Sent: Monday, June 11, 2012 12:04 PM
To: dev@trafficserver.apache.org
Cc: 오재경
Subject: Re: a plugin to specific domain. need helps.

On 6/10/12 8:53 PM, 오재경 wrote:
> Well.....What I want to do is to make a transform plugin only for a 
> specific domain(or specified url) and I think I can't make that 
> through TrafficServer SDK.
>
> TrafficServer seems to have two types of plugins, the one is remap 
> type and the other one is transform type. remap type plugin can do 
> something for a specific domain(or specified url) while transform 
> plugin can't be configured to be called only for a domain.
>
> For example, I'd like to make a throttling plugin to be called only 
> for the request "http://exampleA.com/mp4/big.mp4"; but I don't  want it 
> to be called for the request "http://exampleA.com/normal/small.htm";


You can combine two into one plugin. You make a remap plugin that the only
thing it does it to tell the transform plugin that it should be activated
or not. Just like the header_filter plugin does.

So, what you do is e.g.

map http://exampleA.com http://origin.exampleA.com @plugin=your_plugin.so

your_plugin.so implements both the remap plugin, and creates a transform
hook. In plugins.config, you also add your_plugin.so. When the remap plugin
triggers, you set a transaction specific state, telling the READ_RESPONSE
header hook to create the transform or not (using TSHttpTxnArgSet() and
Get()).

I did not tell you to try the header_filter plugin, i said to look how it
implements this exact behavior. Look at it more carefully, and you will see
that it's both a remap plugin (activated via remap.config) and a normal
plugin (activated via plugins.config).

You can not use the TSContCreate etc. APIs in the remap plugin. Again, what
you should do is tell your other global hook plugins if they should do
something or not, just like header_filter does.

Not sure how else to explain this.

-- leif

Reply via email to