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

John_Heyer_1508's avatar
John_Heyer_1508
Icon for Cirrostratus rankCirrostratus
Aug 09, 2017

iRule Variables and Connection Re-Use

I have an iRule that does 301 redirects within the same site, and have noticed when the client reuses the connection the variables seem to not be re-initialized.

 

when HTTP_REQUEST {
    set HOST [HTTP::host]
    set PATH [HTTP::path]

    if { [class match $PATH eq www_redirects] } {
      set ACTION "redirect"
      set VALUE [class match -value $PATH equals www_redirects]
    }
    if { [info exists ACTION] } {
      if { $ACTION eq "redirect" } {
        HTTP::respond 301 "Location" "https://$HOST$VALUE"
      }
    }
}

 

The browser does a wget to https://mysite.com/old it gets redirect to https://mysite.com/new as expected. But then gets redirect to https://mysite.com/new, https://mysite.com/new, https://mysite.com/new etc

Logging shows that $ACTION is still being set to "redirect" on the subsequent requests, so it's as if it's not being re-initialized when the new HTTP request comes in.

11 Replies

  • Ahh thanks. I'd been playing with the http2 profile to see if it affected behavior and this appeared to break the rule completely, so that explains it.

     

    Is there an F5 Bug ID?