adding text to URL via outbound-rule

5 views
Skip to first unread message

dominiksh

unread,
Sep 30, 2009, 11:16:24 AM9/30/09
to UrlRewrite
Hi,

I need to add text to outgoing URLs by using an outbound-rule, but my
solutions does not seem to work

<outbound-rule enabled="true">
<from>/xyz/(.*)</from>
<to encode="true" last="true">/xyz/added/$1</to>
</outbound-rule>

What I want to achieve is to turn e.g. http://www.example.com/xyz/foo.jsp
into http://www.example.com/xyz/added/foo.jsp

What I get is http://www.example.com/xyz/added/added/added/foo.jsp,
which is obviously not what I expected. :-(

Can anybody please help me?

Thanks in advance,
Dominik

Wim De Smet

unread,
Oct 1, 2009, 5:36:22 AM10/1/09
to urlre...@googlegroups.com
Hi,

On Wed, Sep 30, 2009 at 5:16 PM, dominiksh <domini...@googlemail.com> wrote:
> [...]


> <outbound-rule enabled="true">
>        <from>/xyz/(.*)</from>
>        <to encode="true" last="true">/xyz/added/$1</to>
> </outbound-rule>
>
> What I want to achieve is to turn e.g. http://www.example.com/xyz/foo.jsp
> into http://www.example.com/xyz/added/foo.jsp
>
> What I get is http://www.example.com/xyz/added/added/added/foo.jsp,
> which is obviously not what I expected. :-(

What's happening is you've probably got uwf setup to listen to
FORWARDs as well as REQUEST, so when it hits your rule the first time,
it rewrites it and stops, then does an FORWARD, at which point it
picks up on the request again and rewrites it.

I'd advise you to remove the <dispatcher>FORWARD</dispatcher> line
from your uwf filter-mapping in web.xml. If you need uwf to listen to
internal redirects you'll have to rewrite your rule to make sure it
can only match the first url and not the second (in this case perhaps
with negative lookahead).

regards,
Wim

dominiksh

unread,
Oct 2, 2009, 4:40:28 AM10/2/09
to UrlRewrite
Hi,

thanks for your help. Using a negative lookahead helped in this
case. :-)

On 1 Okt., 11:36, Wim De Smet <krom...@gmail.com> wrote:
> Hi,
>
> On Wed, Sep 30, 2009 at 5:16 PM, dominiksh <dominik.ho...@googlemail.com> wrote:
> > [...]
> > <outbound-rule enabled="true">
> >        <from>/xyz/(.*)</from>
> >        <to encode="true" last="true">/xyz/added/$1</to>
> > </outbound-rule>
>
> > What I want to achieve is to turn e.g.http://www.example.com/xyz/foo.jsp
> > intohttp://www.example.com/xyz/added/foo.jsp
>
> > What I get ishttp://www.example.com/xyz/added/added/added/foo.jsp,
Reply all
Reply to author
Forward
0 new messages