Forum Discussion
Need help with redirect iRule
I've setup two virtual server's, one intended for our mobile site (https://mobile.site.com), and another that uses the same IP for HTTP to HTTPS redirects (http://mobile.site.com). As of now, the HTTP version is using the pre-loaded iRule, _sys_https_redirect, but now have a more specific need.
Traffic requesting our HTTPS virtual server, https://mobile.site.com, needs to be redirected to https://mobile.site.com/User/MobileSiteStart/List
In addition, any traffic destined to the HTTP virtual server needs to get to that same location.
Unfortunately, I'm at a loss of how to accomplish this. Any help would be greatly appreciated.
Thanks!
Jeff B
15 Replies
- nitass
Employee
this is irule.
e.g.[root@ve10:Active] config b virtual bar80 list virtual bar80 { snat automap pool foo destination 172.28.19.79:80 ip protocol 6 rules myrule profiles { http {} tcp {} } } [root@ve10:Active] config b virtual bar443 list virtual bar443 { snat automap pool foo destination 172.28.19.79:443 ip protocol 6 rules myrule profiles { clientssl { clientside } http {} tcp {} } } [root@ve10:Active] config b rule myrule list rule myrule { when HTTP_REQUEST { if {[HTTP::uri] equals "/"} { HTTP::redirect https://[HTTP::host]/User/MobileSiteStart/List } } } [root@ve10:Active] config curl -I http://172.28.19.79 HTTP/1.0 302 Found Location: https://172.28.19.79/User/MobileSiteStart/List Server: BigIP Connection: Keep-Alive Content-Length: 0 [root@ve10:Active] config curl -Ik https://172.28.19.79 HTTP/1.0 302 Found Location: https://172.28.19.79/User/MobileSiteStart/List Server: BigIP Connection: Keep-Alive Content-Length: 0 - Mohamed_Lrhazi
Altocumulus
> I created a new HTTP class that matches all, with the 'Send To' option set to 'Redirect To...'
You are telling to reditect evey request... you need to restrict it to requests where the URI is: "/"
- hoolio
Cirrostratus
Hey Mohamed,
Thanks for all of the contributions as of late. We definitely appreciate they help you're giving to users.
Aaron - Jeff_Bull_42197
Nimbostratus
Ah, ok. I'm using the GUI, so things look a bit different for me then what you mention, so I went ahead and changed the match statement for 'URI Path' to Match Only on the string "/"
I'll let you know if that produces different results - Jeff_Bull_42197
Nimbostratus
Excellent! That worked. Thanks again for all the help Mohamed.
Cheers
Jeff B
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
