Forum Discussion
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
- John_Heyer_1508
Cirrostratus
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?
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
