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

Micros_88999's avatar
Micros_88999
Icon for Nimbostratus rankNimbostratus
May 08, 2014

https to http force iRule worked on 9.4.6 doesn'twork at 11.4

Hello,

 

We would have the below iRules which worked for us at BIG-IP 9.4.6 Build 401.0 Final version. We force https traffic to http and rewrite the answer from the pool member. Now we migrated the Virtual LoadBalancer to 11.4 and now the iRulse doesn't work for us.

 

when HTTP_REQUEST { if { not ([HTTP::uri] equals "/") } then { eval [LB::select] set orig_fqdn [HTTP::host] set selected_server "[LB::server addr]:[LB::server port]" if { [HTTP::host] contains "ourdomain.com" } { HTTP::header replace host $selected_server } } else { HTTP::redirect "/website/Welcome.do" } }

 

when HTTP_RESPONSE { if { [HTTP::is_redirect] }{ HTTP::header replace Location [string map [list $selected_server $orig_fqdn] [HTTP::header Location]] if { [HTTP::header "Location"] contains "http://" } { HTTP::header replace Location [string map [list "http://" "https://"] [HTTP::header Location]] } } }

 

Please let me know if you have any resource concerning the new feature of iRule or the differences between the 9.4.6 and 11.6 iRule .

 

Best Regards,

 

Csaba

 

4 Replies

  • Give this a shot:

    when HTTP_REQUEST {
        if { [HTTP::uri] equals "/" } {
            HTTP::redirect "/website/Welcome.do"
        } else {
            eval [LB::select] 
            set orig_fqdn [HTTP::host] 
            set selected_server "[LB::server addr]:[LB::server port]" 
            if { [HTTP::host] contains "ourdomain.com" } { 
                HTTP::header replace host $selected_server 
            }
        }       
    }
    when HTTP_RESPONSE { 
        if { [HTTP::is_redirect] } { 
            HTTP::header replace Location [string map [list $selected_server $orig_fqdn] [HTTP::header Location]] 
            if { [HTTP::header "Location"] contains "http://" } { 
                HTTP::header replace Location [string map [list "http://" "https://"] [HTTP::header Location]] 
            } 
        } 
    }
    
  • Hello,

     

    No the url still hanging, it doesn't add the simple suffix either.

     

    Best Regards,

     

    Csaba

     

  • I believe there's an issue with HTTP::is_redirect in 11.4 (and 11.5). Are you seeing any errors in /var/log/ltm? Please try the following:

    when HTTP_REQUEST {
        if { [HTTP::uri] equals "/" } {
            HTTP::redirect "/website/Welcome.do"
        } else {
            eval [LB::select] 
            set orig_fqdn [HTTP::host] 
            set selected_server "[LB::server addr]:[LB::server port]"
            if { [HTTP::host] contains "ourdomain.com" } {
                HTTP::header replace host $selected_server 
            }
        }       
    }
    when HTTP_RESPONSE { 
        if { [HTTP::header exists Location] } {
            HTTP::header replace Location [string map [list $selected_server $orig_fqdn] [HTTP::header Location]] 
            if { [HTTP::header "Location"] contains "http://" } { 
                HTTP::header replace Location [string map [list "http://" "https://"] [HTTP::header Location]] 
            } 
        } 
    }
    
  • Hello,

     

    No There wasn't any log in there. But we had to move this site to production so we made a workaround which will be the final solution.

     

    Thanks for your help in this case, but this IRule is unnecessary for us now.

     

    Best Regards,

     

    Csaba