adding text to URL via outbound-rule

View: New views
3 Messages — Rating Filter:   Alert me  

adding text to URL via outbound-rule

by dominiksh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "UrlRewrite" group.
To post to this group, send email to urlrewrite@...
To unsubscribe from this group, send email to urlrewrite+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/urlrewrite?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: adding text to URL via outbound-rule

by Wim De Smet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi,

On Wed, Sep 30, 2009 at 5:16 PM, dominiksh <dominik.hoelz@...> 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

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "UrlRewrite" group.
To post to this group, send email to urlrewrite@...
To unsubscribe from this group, send email to urlrewrite+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/urlrewrite?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: adding text to URL via outbound-rule

by dominiksh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi,

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

On 1 Okt., 11:36, Wim De Smet <krom...@...> wrote:

> Hi,
>
> On Wed, Sep 30, 2009 at 5:16 PM, dominiksh <dominik.ho...@...> 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,
> > 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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "UrlRewrite" group.
To post to this group, send email to urlrewrite@...
To unsubscribe from this group, send email to urlrewrite+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/urlrewrite?hl=en
-~----------~----~----~----~------~----~------~--~---