Forum Discussion
irule executes twice when refreshing a website
- Sep 13, 2016
Try unsetting your variables at the end of the iRule? Specifically...
unset $newSubdomain
Try unsetting your variables at the end of the iRule? Specifically...
unset $newSubdomain
- Lukasz_01_15307Sep 13, 2016Nimbostratus
Hi ekaleido, this actually made my website unavailable for some reason...
error "connection reset" in chrome...
- ekaleidoSep 13, 2016Cirrus
Using the following modifications? What is being logged?
when HTTP_REQUEST { log local0. "-------------------------------------------------------------" log local0. "Path [HTTP::path]" if { not ([HTTP::path] starts_with "/api/") } { return } set apiType [lindex [split [HTTP::path] "/"] 2] log local0. "api type $apiType" append newSubdomain $apiType .uat. log local0. "New Subdomain $newSubdomain" HTTP::header replace "Host" [string map [list "api-uat." $newSubdomain ] [HTTP::host]] log local0. "-------True" HTTP::path [string map [list "/api/$apiType" "/api"] [HTTP::path]] log local0. "New Path [HTTP::host][HTTP::path]" unset $newSubdomain }
- Lukasz_01_15307Sep 13, 2016Nimbostratus
the error was
warning: [variable reference used where variable name expected][$newSubdomain]
so I changed
unset $newSubdomain
to
unset newSubdomain
and it seems to be working.
Thanks! 🙂
a question... Why would irule require a variable to be unset? shouldn't all local variable be unset at the end of the script? as far as I know this is a local variable...
- ekaleidoSep 13, 2016Cirrus
Oddly enough, the variables don't get reset by default. This is especially annoying if you reuse variable names across iRules and they step on each other. :(
- Lukasz_01_15307Sep 13, 2016Nimbostratus
I see! thanks a lot for your help... i'm pretty sure this is a bug!
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