Redirect / rewrite

Hello Experts,

I’m trying to redirect/rewrite the below, but getting nowhere :

Original : http://abc.com/xxx/yyy should be converted to New : https://10.1.1.1/xxx/yyy

Tried with the coding but not working : if { [string tolower [HTTP::host]] ends_with “abc.com” } { HTTP::redirect “https://10.1.1.1[HTTP::uri]” }

Did tried with policy as well, and doesnt seems to working..

Thanks in advance.

It’s not supposed to work, unless client has a route to 10.1.1.1. Client must either be in the local network, or have some sort of VPN connectivity to 10.1.1.1 from a 3rd party site.

iRule is correct and it does work on any virtual server with HTTP profile attached. I’m sure you also use it in the correct event (when HTTP_REQUEST). My only suggestion is to use the “event disable” and “TCP::close” commands after the redirect statement (required for the redirect functionality to work the same in case user opens multiple tabs).

It’s not supposed to work, unless client has a route to 10.1.1.1. Client must either be in the local network, or have some sort of VPN connectivity to 10.1.1.1 from a 3rd party site.

iRule is correct and it does work on any virtual server with HTTP profile attached. I’m sure you also use it in the correct event (when HTTP_REQUEST). My only suggestion is to use the “event disable” and “TCP::close” commands after the redirect statement (required for the redirect functionality to work the same in case user opens multiple tabs).

thanks for your reply, but actually we just need the url to be rewrite from http://abc.com/xxx/yyy to https://10.1.1.1/xxx/yyy. But what the irules does is convert it to https://10.1.1.1http://abc.com/xxx/yyy, appending the original url..

thanks for your reply, but actually we just need the url to be rewrite from http://abc.com/xxx/yyy to https://10.1.1.1/xxx/yyy. But what the irules does is convert it to https://10.1.1.1http://abc.com/xxx/yyy, appending the original url..

i think i know why its not working..

the HTTP::uri is returning the entire URL (http://abc.com/xxx/yyy) instead of the uri(/xxx/yyy)

i cant find any bug for the version im running.. 11.5.1 HF5..

Tested in 11.5.1 HF5 and HTTP::uri works just fine. You may want to verify again. May try with HTTP::path as well.