Forum Discussion

Clayton_Wagner_'s avatar
Clayton_Wagner_
Icon for Nimbostratus rankNimbostratus
Nov 20, 2013

https to https redirect based on user-agent

I have the following irule setup and working in my infrastructure. Recently we added a feature on my website that requires me to make this same redirect work for SSL traffic. We also do SSL offload to our backend if that's relevant. In this case what I need to do is: 1) decrypt on the F5 -> look at the user-agent -> if mobile send a redirect -> if non-mobile go to pool.

 

Does anyone have a sample or an idea of how to make this work correctly?

 

when HTTP_REQUEST { if {[HTTP::cookie exists "MobileOptOut"]}{ return } elseif {[class match [string tolower [HTTP::uri]] contains ImageList]} { return } elseif { [string tolower [HTTP::uri]] starts_with "/mobile" } { HTTP::redirect http://m.site.com } elseif {[class match [string tolower [HTTP::header User-Agent]] contains MobileAgentList]} { HTTP::redirect http://m.site.com[HTTP::uri] } }

 

3 Replies

  • As long as you're decrypting at the F5, your existing iRule should work the same, barring perhaps a redirect to https://m.site.com.

     

  • Hi Kevin,

     

    Thanks for your response, but unfortunately it doesn't work the same. I did attempt with "https" as well.

     

    Clayton