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/12/03 14:51:29 UTC
Regex Remap plugin - follow redirect
Is there way we can modify the path of a filename requested to an origin?
In this example, I want to remove the "path" portion and only send the
"filename" to the origin.
Looks like regex_map won't work from documentation (there is no
regex_remap?) :
"Only the host field can contain a regex; the scheme, port, and other
fields cannot. For path manipulation via regexes, use the regex_remap
plugin"
Here's what I tried :
regex remap plugin line : ^/this.that.com/t.*/(.*)$ http://origin/$1
Original remapped request : http://origin/this.that.com/t1/test.ts
Wanted modified request : http://origin/test.ts
Although, this returns a 302 redirect to the client instead of forwarding
to parent or origin.
Hopefully I described this properly. Thanks,
Steve
Re: Regex Remap plugin - follow redirect
Posted by Jeremy Payne <jp...@gmail.com>.
This is doable with the lua plugin.
On Thu, Dec 3, 2015 at 7:51 AM, Steve Malenfant <sm...@gmail.com>
wrote:
> Is there way we can modify the path of a filename requested to an origin?
> In this example, I want to remove the "path" portion and only send the
> "filename" to the origin.
>
>
> Looks like regex_map won't work from documentation (there is no
> regex_remap?) :
>
> "Only the host field can contain a regex; the scheme, port, and other
> fields cannot. For path manipulation via regexes, use the regex_remap
> plugin"
>
>
> Here's what I tried :
>
> regex remap plugin line : ^/this.that.com/t.*/(.*)$ http://origin/$1
>
>
> Original remapped request : http://origin/this.that.com/t1/test.ts
>
> Wanted modified request : http://origin/test.ts
>
>
> Although, this returns a 302 redirect to the client instead of forwarding
> to parent or origin.
>
> Hopefully I described this properly. Thanks,
>
>
> Steve
>
Re: Regex Remap plugin - follow redirect
Posted by Miles Libbey <ml...@apache.org>.
I think this is indeed doable with the regex_remap plugin. Something like
map http://origin/ \ http://thispartdoesntmatter \ @plugin=regex_remap.so @pparam=regex.config
where regex.config is your regex^/this.that.com/t.*/(.*)$ http://origin/$1
On Thursday, December 3, 2015 8:12 AM, Steve Malenfant <sm...@gmail.com> wrote:
Leif,
I believe that's one I use that sends back a redirect to the user. I wanted to make the transfer and forward through the parent/origin.
Steve
On Thu, Dec 3, 2015 at 10:13 AM, Leif Hedstrom <zw...@apache.org> wrote:
On Dec 3, 2015, at 6:51 AM, Steve Malenfant <sm...@gmail.com> wrote:
Is there way we can modify the path of a filename requested to an origin? In this example, I want to remove the "path" portion and only send the "filename" to the origin.
Looks like regex_map won't work from documentation (there is no regex_remap?) :"Only the host field can contain a regex; the scheme, port, and other fields cannot. For path manipulation via regexes, use the regex_remap plugin"
Here's what I tried :regex remap plugin line : ^/this.that.com/t.*/(.*)$ http://origin/$1
Original remapped request : http://origin/this.that.com/t1/test.ts
That is correct. There is a plugin to address this:
https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/regex_remap.en.html
— leif
Re: Regex Remap plugin - follow redirect
Posted by Steve Malenfant <sm...@gmail.com>.
Leif,
I believe that's one I use that sends back a redirect to the user. I wanted
to make the transfer and forward through the parent/origin.
Steve
On Thu, Dec 3, 2015 at 10:13 AM, Leif Hedstrom <zw...@apache.org> wrote:
>
> On Dec 3, 2015, at 6:51 AM, Steve Malenfant <sm...@gmail.com> wrote:
>
> Is there way we can modify the path of a filename requested to an origin?
> In this example, I want to remove the "path" portion and only send the
> "filename" to the origin.
>
>
> Looks like regex_map won't work from documentation (there is no
> regex_remap?) :
>
> "Only the host field can contain a regex; the scheme, port, and other
> fields cannot. For path manipulation via regexes, use the regex_remap
> plugin"
>
>
> Here's what I tried :
>
> regex remap plugin line : ^/this.that.com/t.*/(.*)$ http://origin/$1
>
>
> Original remapped request : http://origin/this.that.com/t1/test.ts
>
>
>
> That is correct. There is a plugin to address this:
>
>
> https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/regex_remap.en.html
>
>
> — leif
>
>
>
Re: Regex Remap plugin - follow redirect
Posted by Leif Hedstrom <zw...@apache.org>.
> On Dec 3, 2015, at 6:51 AM, Steve Malenfant <sm...@gmail.com> wrote:
>
> Is there way we can modify the path of a filename requested to an origin? In this example, I want to remove the "path" portion and only send the "filename" to the origin.
>
>
>
> Looks like regex_map won't work from documentation (there is no regex_remap?) :
>
> "Only the host field can contain a regex; the scheme, port, and other fields cannot. For path manipulation via regexes, use the regex_remap plugin"
>
>
>
> Here's what I tried :
>
> regex remap plugin line : ^/this.that.com/t.*/(.*)$ <http://this.that.com/t.*/(.*)$> http://origin/$1 <http://origin/$1>
>
> Original remapped request : http://origin/this.that.com/t1/test.ts <http://origin/this.that.com/t1/test.ts>
>
That is correct. There is a plugin to address this:
https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/regex_remap.en.html
— leif