i use the lua plugin to change origin host based on certain conditions.

https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/ts_lua.en.html#ts-client-request-set-url-host

On Wed, Jan 25, 2017 at 12:33 PM, Adi Mallikarjuna Reddy V <
[email protected]> wrote:

> any help with this is greatly appreciated. Is there a debug flag to check
> header rewrite functionality?
>
> On Tue, Jan 24, 2017 at 1:42 PM, Adi Mallikarjuna Reddy V <
> [email protected]> wrote:
>
>> Thanks Sudheer for the pointer. I tried the following and it looks like
>> this condition is not working
>>
>> cond %{READ_REQUEST_HDR_HOOK}
>>
>> cond %{CLIENT-HEADER:DEVHOST} = dev103
>>
>> set-destination HOST dev103.abc.com [L]
>>
>>
>> and
>>
>> curl -H 'DEVHOST:dev103' 'http://actual_ats_endpoint/path' -v doesnt
>> take to that host specified.
>>
>>
>>
>> Thanks
>>
>> Adi
>>
>>
>>
>> On Tue, Jan 24, 2017 at 12:28 PM, Sudheer Vinukonda <
>> [email protected]> wrote:
>>
>>> You'd need to specify a preremap request hook (such as Read Request
>>> Header) in your rules. I think the default hook is Send Response Header.
>>>
>>> - Sudheer
>>>
>>> On Jan 24, 2017, at 12:24 PM, Adi Mallikarjuna Reddy V <
>>> [email protected]> wrote:
>>>
>>> Ok, I tried the following one with no luck. The requests are always
>>> going to the new host without the customer header value also.
>>>
>>> cond %{HEADER:DEV_HOST} = "dev102"
>>> set-destination HOST dev102.abc.com [L]
>>>
>>>
>>> my remap rule is
>>>
>>> map / http://abc.com/ @pristine_host_hdr=1 @plugin=header_rewrite.so
>>> @pparam=my_header_rules.conf
>>>
>>>
>>> Am I missing anything important here?
>>>
>>>
>>> Thanks
>>>
>>> Adi
>>>
>>> On Tue, Jan 24, 2017 at 11:46 AM, Jeremy Payne <[email protected]>
>>> wrote:
>>>
>>>> the lua plugin also has this functionality although may be somewhat
>>>> overkill for your needs.
>>>>
>>>>
>>>> On Tue, Jan 24, 2017 at 1:43 PM, Adi Mallikarjuna Reddy V <
>>>> [email protected]> wrote:
>>>>
>>>>> So to achieve my use case, can I try something like this?
>>>>>
>>>>> map / http://b.bar.com @plugin=header_rewrite.so @pparam=rules1.conf
>>>>>
>>>>> and my rules1.conf has
>>>>>
>>>>> cond %{HEADER:MY_HEADER} = "foo"
>>>>> set-destination HOST mobile.bar.com [L]
>>>>>
>>>>> This should forward the request to mobile.bar.com if the request has 
>>>>> 'MY_HEADER' with value 'foo'.
>>>>>
>>>>>
>>>>> Thanks
>>>>>
>>>>> Adi
>>>>>
>>>>>
>>>>>
>>>>> On Tue, Jan 24, 2017 at 11:36 AM, Brian Geffon <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> Sorry I think I meant header_rewrite.
>>>>>>
>>>>>> Brian
>>>>>>
>>>>>> On Tue, Jan 24, 2017, 11:26 Brian Geffon <[email protected]>
>>>>>> wrote:
>>>>>>
>>>>>>> There is a regex_remap plugin that is what you would want, take a
>>>>>>> look in plugins/
>>>>>>>
>>>>>>> Brian
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Jan 24, 2017, 11:25 Adi Mallikarjuna Reddy V <
>>>>>>> [email protected]> wrote:
>>>>>>>
>>>>>>> Is there a config that allows to change remap rule based on the
>>>>>>> incoming header?
>>>>>>>
>>>>>>>
>>>>>>> My use case is , if I send a custom header in the request, the remap
>>>>>>> rule should be changed to different one than the default one configured.
>>>>>>>
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>> Adi
>>>>>>>
>>>>>>>
>>>>>
>>>>
>>>
>>
>

Reply via email to