Forum Discussion
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.
6 Replies
- Hannes_Rapp
Nimbostratus
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).
- annielee_13548
Nimbostratus
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..
- Hannes_Rapp_162
Nacreous
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).
- annielee_13548
Nimbostratus
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..
- annielee_13548
Nimbostratus
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..
- kunjan
Nimbostratus
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.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com