Forum Discussion
PeteWhite
Sep 13, 2018Employee
Currently this is setting the secure flag for all cookies and all requests. It's obviously doing the job but the scope is broad so it is using CPU.
You should have a flag in the HTTP_REQUEST event that is set to true when accessing via IP address. A good way to match IP addresses is using the class. ie put the IP address in the class and match the class in the iRule.
Something like this:
when HTTP_REQUEST {
if { [class match -- [HTTP::host] equals host_dg] } {
set setSecure 1
}
}
when HTTP_RESPONSE {
if { $setSecure } {
foreach cookie [HTTP::cookie names] {
HTTP::cookie secure $cookie enable
}
}
}