You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by Steve Malenfant <sm...@gmail.com> on 2015/08/28 17:02:53 UTC

regex_remap and $p

Some looked at the code, and seems like this "$p" applies to the "request
URL" which would be the left side of the remap line. Although from my
testing, it applies to the origin port (right side). What is the
expectation?

https://docs.trafficserver.apache.org/en/latest/reference/configuration/remap.config.en.html

$p     - The original port number

The goal here is to to remove any query string and keep the origin port
defined in the remap line.

Discussion available here :
https://github.com/Comcast/traffic_control/pull/297

Some quick details about the configuration...

remap.config :

map http://edge01/ http://origin:8081/ @plugin=regex_remap.so
@pparam=drop_qstring.config

drop_qstring.config :

/([^?]+) $s://$t:$p/$1

Old drop_qstring.config (which drops the origin port) :

/([^?]+) $s://$t/$1

Thanks,

Steve

Re: regex_remap and $p

Posted by Sudheer Vinukonda <su...@yahoo-inc.com>.
Yes, it's not very clear unfortunately, but, the regex_remap config file param is mandatory. 

I typically use something like the below as the regex config:


% cat remap.config
map http://edge.com/ http://origin.com:8081/ @plugin=regex_remap.so @pparam=my_rule.map @pparam=no-query-string

% cat my_rule.map
^/(.*)$ $s://$t/$1

FWIU, $t is the one defined as the destination in the remap rule. 

Thanks,

Sudheer



On Friday, September 4, 2015 1:58 PM, Steve Malenfant <sm...@gmail.com> wrote:



So I tried this, but you can't use only @pparam=no-query-string, you got to specify something to do. What would I put in the first "maps.reg" to keep the origin port?

Example :
map http://edge/     http://origin:8081/ @plugin=regex_remap.so @pparam=maps.reg @pparam=no-query-string

What would I need to put in maps.reg?

The host used in the "to" portion should have the Port with it. Is this referring to "Host Header" ?
$t    - The host as used in the "to" portion of the remap rule


On Wed, Sep 2, 2015 at 9:40 PM, Steve Malenfant <sm...@gmail.com> wrote:

Will try this. Thanks!
>
>
>On Wed, Sep 2, 2015 at 11:05 AM, Sudheer Vinukonda <su...@yahoo-inc.com> wrote:
>
>Not sure if you have tried it, but, regex_remap supports a "no-query-string" param, which allows you to simply skip the query component..
>>
>>
>>https://docs.trafficserver.apache.org/en/latest/reference/plugins/regex_remap.en.html
>>
>>
>>"By default, the query string is part of the string that is matched again, to turn this off use the option ‘no-query-string’, e.g.
>>
>>... @pparam=maps.reg @pparam=no-query-string"
>>
>>
>>
>>Thanks,
>>
>>Sudheer
>>
>>
>>On Wednesday, September 2, 2015 7:56 AM, Steve Malenfant <sm...@gmail.com> wrote:
>>
>>
>>
>>Haven't tested with lua. We noticed the behavior changes when regex_remap is used with header_rewrite.
>>
>>regex_remap by itself $p is the "original request port"
>>regex_remap with header_rewrite $p is the "origin port"
>>
>>We investigating this at the moment. Would be nice to have regex_remap support the different type or components from an uri.
>>
>>https://en.wikipedia.org/wiki/Uniform_resource_identifier
>>
>>"authority part" for example to keep username:password@example.com:123
>> or even "hierarchical part" so would just be easier to drop query strings.
>>
>>
>>On Tue, Sep 1, 2015 at 8:57 AM, Jason Strongman <ja...@gmail.com> wrote:
>>
>>Steve,
>>>
>>>Is there any benefit to using this plugin, as opposed to processing
>>>via the lua plugin?
>>>Any performance concerns as load increases?
>>>
>>>
>>>
>>>
>>>On Fri, Aug 28, 2015 at 10:02 AM, Steve Malenfant <sm...@gmail.com> wrote:
>>>> Some looked at the code, and seems like this "$p" applies to the "request
>>>> URL" which would be the left side of the remap line. Although from my
>>>> testing, it applies to the origin port (right side). What is the
>>>> expectation?
>>>>
>>>> https://docs.trafficserver.apache.org/en/latest/reference/configuration/remap.config.en.html
>>>>
>>>> $p     - The original port number
>>>>
>>>> The goal here is to to remove any query string and keep the origin port
>>>> defined in the remap line.
>>>>
>>>> Discussion available here :
>>>> https://github.com/Comcast/traffic_control/pull/297
>>>>
>>>> Some quick details about the configuration...
>>>>
>>>> remap.config :
>>>>
>>>> map http://edge01/ http://origin:8081/ @plugin=regex_remap.so
>>>> @pparam=drop_qstring.config
>>>>
>>>> drop_qstring.config :
>>>>
>>>> /([^?]+) $s://$t:$p/$1
>>>>
>>>> Old drop_qstring.config (which drops the origin port) :
>>>>
>>>> /([^?]+) $s://$t/$1
>>>>
>>>> Thanks,
>>>>
>>>> Steve
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>
>

Re: regex_remap and $p

Posted by Steve Malenfant <sm...@gmail.com>.
So I tried this, but you can't use only @pparam=no-query-string, you got to
specify something to do. What would I put in the first "maps.reg" to keep
the origin port?

Example :
map http://edge/     http://origin:8081/ @plugin=regex_remap.so
@pparam=maps.reg @pparam=no-query-string

What would I need to put in maps.reg?

The host used in the "to" portion should have the Port with it. Is this
referring to "Host Header" ?

$t     - The host as used in the "to" portion of the remap rule


On Wed, Sep 2, 2015 at 9:40 PM, Steve Malenfant <sm...@gmail.com>
wrote:

> Will try this. Thanks!
>
> On Wed, Sep 2, 2015 at 11:05 AM, Sudheer Vinukonda <sudheerv@yahoo-inc.com
> > wrote:
>
>> Not sure if you have tried it, but, regex_remap supports a
>> "no-query-string" param, which allows you to simply skip the query
>> component..
>>
>>
>>
>> https://docs.trafficserver.apache.org/en/latest/reference/plugins/regex_remap.en.html
>>
>>
>> "By default, the query string is part of the string that is matched
>> again, to turn this off use the option ‘no-query-string’, e.g.
>>
>> ... @pparam=maps.reg @pparam=no-query-string"
>>
>>
>>
>> Thanks,
>>
>> Sudheer
>>
>> On Wednesday, September 2, 2015 7:56 AM, Steve Malenfant <
>> smalenfant@gmail.com> wrote:
>>
>>
>>
>> Haven't tested with lua. We noticed the behavior changes when regex_remap
>> is used with header_rewrite.
>>
>> regex_remap by itself $p is the "original request port"
>> regex_remap with header_rewrite $p is the "origin port"
>>
>> We investigating this at the moment. Would be nice to have regex_remap
>> support the different type or components from an uri.
>>
>> https://en.wikipedia.org/wiki/Uniform_resource_identifier
>>
>> "authority part" for example to keep username:password@example.com:123
>>  or even "hierarchical part" so would just be easier to drop query
>> strings.
>>
>>
>> On Tue, Sep 1, 2015 at 8:57 AM, Jason Strongman <
>> jasonstrongman2016@gmail.com> wrote:
>>
>> Steve,
>> >
>> >Is there any benefit to using this plugin, as opposed to processing
>> >via the lua plugin?
>> >Any performance concerns as load increases?
>> >
>> >
>> >
>> >
>> >On Fri, Aug 28, 2015 at 10:02 AM, Steve Malenfant <sm...@gmail.com>
>> wrote:
>> >> Some looked at the code, and seems like this "$p" applies to the
>> "request
>> >> URL" which would be the left side of the remap line. Although from my
>> >> testing, it applies to the origin port (right side). What is the
>> >> expectation?
>> >>
>> >>
>> https://docs.trafficserver.apache.org/en/latest/reference/configuration/remap.config.en.html
>> >>
>> >> $p     - The original port number
>> >>
>> >> The goal here is to to remove any query string and keep the origin port
>> >> defined in the remap line.
>> >>
>> >> Discussion available here :
>> >> https://github.com/Comcast/traffic_control/pull/297
>> >>
>> >> Some quick details about the configuration...
>> >>
>> >> remap.config :
>> >>
>> >> map http://edge01/ http://origin:8081/ @plugin=regex_remap.so
>> >> @pparam=drop_qstring.config
>> >>
>> >> drop_qstring.config :
>> >>
>> >> /([^?]+) $s://$t:$p/$1
>> >>
>> >> Old drop_qstring.config (which drops the origin port) :
>> >>
>> >> /([^?]+) $s://$t/$1
>> >>
>> >> Thanks,
>> >>
>> >> Steve
>> >>
>> >>
>> >>
>> >>
>> >>
>> >
>>
>
>

Re: regex_remap and $p

Posted by Steve Malenfant <sm...@gmail.com>.
Will try this. Thanks!

On Wed, Sep 2, 2015 at 11:05 AM, Sudheer Vinukonda <su...@yahoo-inc.com>
wrote:

> Not sure if you have tried it, but, regex_remap supports a
> "no-query-string" param, which allows you to simply skip the query
> component..
>
>
>
> https://docs.trafficserver.apache.org/en/latest/reference/plugins/regex_remap.en.html
>
>
> "By default, the query string is part of the string that is matched again,
> to turn this off use the option ‘no-query-string’, e.g.
>
> ... @pparam=maps.reg @pparam=no-query-string"
>
>
>
> Thanks,
>
> Sudheer
>
> On Wednesday, September 2, 2015 7:56 AM, Steve Malenfant <
> smalenfant@gmail.com> wrote:
>
>
>
> Haven't tested with lua. We noticed the behavior changes when regex_remap
> is used with header_rewrite.
>
> regex_remap by itself $p is the "original request port"
> regex_remap with header_rewrite $p is the "origin port"
>
> We investigating this at the moment. Would be nice to have regex_remap
> support the different type or components from an uri.
>
> https://en.wikipedia.org/wiki/Uniform_resource_identifier
>
> "authority part" for example to keep username:password@example.com:123
>  or even "hierarchical part" so would just be easier to drop query strings.
>
>
> On Tue, Sep 1, 2015 at 8:57 AM, Jason Strongman <
> jasonstrongman2016@gmail.com> wrote:
>
> Steve,
> >
> >Is there any benefit to using this plugin, as opposed to processing
> >via the lua plugin?
> >Any performance concerns as load increases?
> >
> >
> >
> >
> >On Fri, Aug 28, 2015 at 10:02 AM, Steve Malenfant <sm...@gmail.com>
> wrote:
> >> Some looked at the code, and seems like this "$p" applies to the
> "request
> >> URL" which would be the left side of the remap line. Although from my
> >> testing, it applies to the origin port (right side). What is the
> >> expectation?
> >>
> >>
> https://docs.trafficserver.apache.org/en/latest/reference/configuration/remap.config.en.html
> >>
> >> $p     - The original port number
> >>
> >> The goal here is to to remove any query string and keep the origin port
> >> defined in the remap line.
> >>
> >> Discussion available here :
> >> https://github.com/Comcast/traffic_control/pull/297
> >>
> >> Some quick details about the configuration...
> >>
> >> remap.config :
> >>
> >> map http://edge01/ http://origin:8081/ @plugin=regex_remap.so
> >> @pparam=drop_qstring.config
> >>
> >> drop_qstring.config :
> >>
> >> /([^?]+) $s://$t:$p/$1
> >>
> >> Old drop_qstring.config (which drops the origin port) :
> >>
> >> /([^?]+) $s://$t/$1
> >>
> >> Thanks,
> >>
> >> Steve
> >>
> >>
> >>
> >>
> >>
> >
>

Re: regex_remap and $p

Posted by Sudheer Vinukonda <su...@yahoo-inc.com>.
Not sure if you have tried it, but, regex_remap supports a "no-query-string" param, which allows you to simply skip the query component..


https://docs.trafficserver.apache.org/en/latest/reference/plugins/regex_remap.en.html


"By default, the query string is part of the string that is matched again, to turn this off use the option ‘no-query-string’, e.g.

... @pparam=maps.reg @pparam=no-query-string"



Thanks,

Sudheer

On Wednesday, September 2, 2015 7:56 AM, Steve Malenfant <sm...@gmail.com> wrote:



Haven't tested with lua. We noticed the behavior changes when regex_remap is used with header_rewrite. 

regex_remap by itself $p is the "original request port"
regex_remap with header_rewrite $p is the "origin port"

We investigating this at the moment. Would be nice to have regex_remap support the different type or components from an uri.

https://en.wikipedia.org/wiki/Uniform_resource_identifier

"authority part" for example to keep username:password@example.com:123
 or even "hierarchical part" so would just be easier to drop query strings.


On Tue, Sep 1, 2015 at 8:57 AM, Jason Strongman <ja...@gmail.com> wrote:

Steve,
>
>Is there any benefit to using this plugin, as opposed to processing
>via the lua plugin?
>Any performance concerns as load increases?
>
>
>
>
>On Fri, Aug 28, 2015 at 10:02 AM, Steve Malenfant <sm...@gmail.com> wrote:
>> Some looked at the code, and seems like this "$p" applies to the "request
>> URL" which would be the left side of the remap line. Although from my
>> testing, it applies to the origin port (right side). What is the
>> expectation?
>>
>> https://docs.trafficserver.apache.org/en/latest/reference/configuration/remap.config.en.html
>>
>> $p     - The original port number
>>
>> The goal here is to to remove any query string and keep the origin port
>> defined in the remap line.
>>
>> Discussion available here :
>> https://github.com/Comcast/traffic_control/pull/297
>>
>> Some quick details about the configuration...
>>
>> remap.config :
>>
>> map http://edge01/ http://origin:8081/ @plugin=regex_remap.so
>> @pparam=drop_qstring.config
>>
>> drop_qstring.config :
>>
>> /([^?]+) $s://$t:$p/$1
>>
>> Old drop_qstring.config (which drops the origin port) :
>>
>> /([^?]+) $s://$t/$1
>>
>> Thanks,
>>
>> Steve
>>
>>
>>
>>
>>
>

Re: regex_remap and $p

Posted by Steve Malenfant <sm...@gmail.com>.
Haven't tested with lua. We noticed the behavior changes when regex_remap
is used with header_rewrite.

regex_remap by itself $p is the "original request port"
regex_remap with header_rewrite $p is the "origin port"

We investigating this at the moment. Would be nice to have regex_remap
support the different type or components from an uri.

https://en.wikipedia.org/wiki/Uniform_resource_identifier

"authority part" for example to keep username:password@example.com:123
 or even "hierarchical part" so would just be easier to drop query strings.

On Tue, Sep 1, 2015 at 8:57 AM, Jason Strongman <
jasonstrongman2016@gmail.com> wrote:

> Steve,
>
> Is there any benefit to using this plugin, as opposed to processing
> via the lua plugin?
> Any performance concerns as load increases?
>
>
>
> On Fri, Aug 28, 2015 at 10:02 AM, Steve Malenfant <sm...@gmail.com>
> wrote:
> > Some looked at the code, and seems like this "$p" applies to the "request
> > URL" which would be the left side of the remap line. Although from my
> > testing, it applies to the origin port (right side). What is the
> > expectation?
> >
> >
> https://docs.trafficserver.apache.org/en/latest/reference/configuration/remap.config.en.html
> >
> > $p     - The original port number
> >
> > The goal here is to to remove any query string and keep the origin port
> > defined in the remap line.
> >
> > Discussion available here :
> > https://github.com/Comcast/traffic_control/pull/297
> >
> > Some quick details about the configuration...
> >
> > remap.config :
> >
> > map http://edge01/ http://origin:8081/ @plugin=regex_remap.so
> > @pparam=drop_qstring.config
> >
> > drop_qstring.config :
> >
> > /([^?]+) $s://$t:$p/$1
> >
> > Old drop_qstring.config (which drops the origin port) :
> >
> > /([^?]+) $s://$t/$1
> >
> > Thanks,
> >
> > Steve
> >
> >
> >
> >
> >
>

Re: regex_remap and $p

Posted by Jason Strongman <ja...@gmail.com>.
Steve,

Is there any benefit to using this plugin, as opposed to processing
via the lua plugin?
Any performance concerns as load increases?



On Fri, Aug 28, 2015 at 10:02 AM, Steve Malenfant <sm...@gmail.com> wrote:
> Some looked at the code, and seems like this "$p" applies to the "request
> URL" which would be the left side of the remap line. Although from my
> testing, it applies to the origin port (right side). What is the
> expectation?
>
> https://docs.trafficserver.apache.org/en/latest/reference/configuration/remap.config.en.html
>
> $p     - The original port number
>
> The goal here is to to remove any query string and keep the origin port
> defined in the remap line.
>
> Discussion available here :
> https://github.com/Comcast/traffic_control/pull/297
>
> Some quick details about the configuration...
>
> remap.config :
>
> map http://edge01/ http://origin:8081/ @plugin=regex_remap.so
> @pparam=drop_qstring.config
>
> drop_qstring.config :
>
> /([^?]+) $s://$t:$p/$1
>
> Old drop_qstring.config (which drops the origin port) :
>
> /([^?]+) $s://$t/$1
>
> Thanks,
>
> Steve
>
>
>
>
>