You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by 彭勇 <pp...@pubyun.com> on 2017/03/09 09:15:49 UTC
problem when rewrite host header with plugin header_rewrite
I would like to like rewrite host header with regex:
some.domain.abc.com -> some.domain
here is regex:
/(.*)\.abc\.com$/ -> $1
i dig into header_rewrite doc and code, but i don't know how to write
the rewrite rule with regex:
cond %{SEND_REQUEST_HDR_HOOK}
cond %{HEADER:HOST} /(.*)\.abc\.com$/
set-header host how_to_write_some_regex_value
here is some hint in document:
Setting a header with a value can take the following formats:
Any condition which extracts a value from the request.
$N, where 0 <= N <= 9, from matching groups in a regular expression.
--
Peng Yong
Re: problem when rewrite host header with plugin header_rewrite
Posted by Nick Kew <ni...@apache.org>.
On Fri, 2017-03-10 at 08:40 +0800, \u5f6d\u52c7 wrote:
> thanks zwoop,
>
> i would like to only rewrite the host header and not the origin server.
>
> the map_regex will rewrite the host header and the origin server.
Check your proxy.config.url_remap.pristine_host_hdr
--
Nick Kew
Re: problem when rewrite host header with plugin header_rewrite
Posted by 彭勇 <pp...@pubyun.com>.
thanks zwoop,
i would like to only rewrite the host header and not the origin server.
the map_regex will rewrite the host header and the origin server.
On Thu, Mar 9, 2017 at 11:25 PM, Leif Hedstrom <zw...@apache.org> wrote:
> You can do this with map_regex without a plugin I think.
>
> -- Leif
>
>> On Mar 9, 2017, at 1:15 AM, 彭勇 <pp...@pubyun.com> wrote:
>>
>> I would like to like rewrite host header with regex:
>>
>> some.domain.abc.com -> some.domain
>>
>> here is regex:
>>
>> /(.*)\.abc\.com$/ -> $1
>>
>> i dig into header_rewrite doc and code, but i don't know how to write
>> the rewrite rule with regex:
>>
>> cond %{SEND_REQUEST_HDR_HOOK}
>> cond %{HEADER:HOST} /(.*)\.abc\.com$/
>> set-header host how_to_write_some_regex_value
>>
>>
>> here is some hint in document:
>>
>> Setting a header with a value can take the following formats:
>>
>> Any condition which extracts a value from the request.
>> $N, where 0 <= N <= 9, from matching groups in a regular expression.
>>
>>
>>
>> --
>> Peng Yong
>
--
Peng Yong
Re: problem when rewrite host header with plugin header_rewrite
Posted by Leif Hedstrom <zw...@apache.org>.
You can do this with map_regex without a plugin I think.
-- Leif
> On Mar 9, 2017, at 1:15 AM, 彭勇 <pp...@pubyun.com> wrote:
>
> I would like to like rewrite host header with regex:
>
> some.domain.abc.com -> some.domain
>
> here is regex:
>
> /(.*)\.abc\.com$/ -> $1
>
> i dig into header_rewrite doc and code, but i don't know how to write
> the rewrite rule with regex:
>
> cond %{SEND_REQUEST_HDR_HOOK}
> cond %{HEADER:HOST} /(.*)\.abc\.com$/
> set-header host how_to_write_some_regex_value
>
>
> here is some hint in document:
>
> Setting a header with a value can take the following formats:
>
> Any condition which extracts a value from the request.
> $N, where 0 <= N <= 9, from matching groups in a regular expression.
>
>
>
> --
> Peng Yong