For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Jeff_Bull_42197's avatar
Jeff_Bull_42197
Icon for Nimbostratus rankNimbostratus
Oct 09, 2012

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

  • 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
    
    
  • > 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's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    Hey Mohamed,

     

     

    Thanks for all of the contributions as of late. We definitely appreciate they help you're giving to users.

     

     

    Aaron
  • 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
  • Excellent! That worked. Thanks again for all the help Mohamed.

     

     

    Cheers

     

     

    Jeff B