Are variables permeable across calls to the same iRule?
Greetings, My question is at the bottom. Some context first.
We have an LTM appliance inline with an ASM appliance (two appliances). LTM front ends the customer side and sends to ASM after. We have customers targetting some web VS by IP addresses (https://10.10.10.10) instead of by URL (https://www.website.com). ASM does not like the calls by IP and blocks them as being a threat. We cannot move away from those calls by IP address unfortunately. So, we were thinking of a simple iRule on LTM to manipulate the "host::" field of the header prior to sending to ASM and upon its return. Something like this:
when HTTP_REQUEST {
if {not ([string tolower [HTTP::host]] starts_with "www.website.com")}{
set hostname [HTTP::host]
HTTP::header replace Host "www.website.com"
}
}
when HTTP_RESPONSE {
HTTP::header replace Host "$hostname"
}
Essentially, whatever HTTP::host the customer arrived with in HTTP_REQUEST is fed back to them in HTTP_RESPONSE via the variable "hostname".
My question: Can the variable "hostname" be modified by another instance of the same irule through another connection or is each variable specific to a particular connection?
For example, if client A arrives with "http://10.10.10.10", the "HTTP_REQUEST" will set the variable "hostname" to "10.10.10.10" (presumably to later be fed back through HTTP_RESPONSE). However, if in the meantime client "B" arrives with "https://www.website.com", BEFORE the HTTP_RESPONSE comes through for client A, will Client A's "hostname" variable value still be at its original "10.10.10.10" value or will it have been modified to "www.website.com" by client B while A was waiting for a response?
Would there be a better approach to this? (other than telling Client A to start using URL instead of IP)
Thank you
- Ben