Forum Discussion

Simon_Wright_85's avatar
Simon_Wright_85
Icon for Nimbostratus rankNimbostratus
Sep 14, 2007

Strange F5 behaviour after adding an iRule

Hi all

We are seeing some very strange behaviour from a pair of our 1500 LTMs running 9.4.0 after restoring a config from a backup to them. The symptom is that a large part of the configuration dissapears in the GUI but looking at the bigip.conf file every think is there. The missing parts are iRules, pools, nodes and virtual servers.

I have narrowed it down to the addition of an iRule (listed below). I cannot guarantee that this is what is causing the problem but once i add this irule, backup the unit and then restore the backup lots of things go missing. I have run a windiff on bigip.conf files taken before and after adding the irule and the only difference between them asside from the date is the text for the irule being in there.

I know this isnt a support forum (we do have a support case open about this) but I am wondering if anyone can see any problem with the irule. It has been on the units for several months but we only tried restoring a config recently when the problem came to light.

My question is does anyone know if there is anything fundamentaly wrong with the rule that they can see?

Thanks in advance

Simon

when HTTP_REQUEST {
if { [HTTP::host] contains "reports."} {
if { [HTTP::uri] == "/" } {
HTTP::redirect https://[HTTP::host]
}
else {HTTP::redirect https://[HTTP::host][HTTP::uri] }
}
elseif { [HTTP::uri] == "/" } {
set cluster1Idx [matchclass [string tolower [HTTP::host]] contains $::G2Cluster1]
if { $cluster1Idx != 0 }
{
set lea [lindex $::G2Cluster1 [expr $cluster1Idx - 1]]
HTTP::redirect https://[HTTP::host]/$lea/
}
else
{
set cluster2Idx [matchclass [string tolower [HTTP::host]] contains $::G2Cluster2]
if { $cluster2Idx != 0 }
{
set lea [lindex $::G2Cluster2 [expr $cluster2Idx - 1]]
HTTP::redirect https://[HTTP::host]/$lea/
}
}
}
else {HTTP::redirect https://[HTTP::host][HTTP::uri] }
}
  • Hi all

    After some further digging on a blank Loadbalancer i have found the following.

    Adding this iRule then backing up and restoring an archive will mean the iRule will dissapear.

    when HTTP_REQUEST {
    if { [HTTP::host] contains "reports."} {
    }
    else {HTTP::redirect https://[HTTP::host][HTTP::uri] }
    }

    However the following version will still appear after backing up and restoring.

    when HTTP_REQUEST {
    if { [HTTP::host] contains "reports."} {
    HTTP::redirect https://[HTTP::host][HTTP::uri] 
    }
    else {}
    }

    If anyone has any ideas why this happens i would be very interested in hearing as i am pulling my hair out trying to work out why.

    Thanks

    Simon
  • It turns out i just needed to put quotes around the redirect as shown below.

    when HTTP_REQUEST {
    if { [HTTP::host] contains "reports."} {
    }
    else {HTTP::redirect "https://[HTTP::host][HTTP::uri]" }
    }

    Still not sure why not having the quotes breaks the LTM though.

    Cheers

    Simon
  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    Hi Simon --

     

     

    Rather odd that the same syntax is acceptable in place but not another.

     

     

    Would you mind sharing the Support case number? I'd be interested in following along.

     

     

    /deb