Forum Discussion

yuanqiang_22112's avatar
yuanqiang_22112
Icon for Nimbostratus rankNimbostratus
Feb 09, 2017

irules: replace mobile client header and pool redirect

Hi: for these images ,when mobile clients visit server,F5 load balance mobile server ; Because of mobile server bind domain ";, so I need F5 to replace mobile clients header to be ";. I write the irules ,but not work ,please help look . Thank you !

 

1 Reply

  • Looks fine to me, but you might want to do a string to lower when comparing the user agent:

    when HTTP_REQUEST {
    
        set ua [string tolower [HTTP::header User-Agent]]
        if { $ua contains "mobile" and $ua contains "android" } {
            HTTP::header replace "Host" "www.new-site.com"
            pool pool_mobile
        }
    
    }
    

    /Patrik