Forum Discussion
bigip networking Configuration Guide
1. in your first if statement, you are comparing a string "[HTTP::uri]" with an array "sites". If you want to compare for a string's existence within a list of items, you'll have to use our "matchclass" command. Also, if you are hand-rolling the list, it needs to be a TCL list, not an array.
when RULE_INIT {
set sites [list \
"/site1" \
"/site2" \
]
}
when HTTP_REQUEST {
if { [matchclass [HTTP::uri] starts_with $::sites] } {
HTTP::redirect "http://www.domain.com/global/[string range [HTTP::uri] 1 end]"
} elseif { [HTTP::uri starts_with "/global" } {
pool site_pool
}
}
2. In your second code sample you are defining the class in the iRule. The "class ..." code that is often posted to these forums is the internal format of the data group (or class) from within the internal configuration. You'll need to define this as a data group within the iRules section of the GUI.
Now, after all that is said, for small lists of items, it is much more optimal to use a switch statement like this:
when HTTP_REQUEST {
switch -glob [HTTP::uri] {
"/site1*" -
"/site2*" {
HTTP::redirect "http://www.domain.com/global/[string range [HTTP::uri] 1 end]"
}
"/global*" {
pool site_pool
}
}
}
-Joe
- Oct 04, 2022
Hi jba3126
I have a few thoughts on this. You might try to debug the contents of the [HTTP::cookie names] function by feeding its output into the log command, and observe the returned names.
I did spot an older forum post which parses the HTTP headers directly instead of using the HTTP::cookie function: https://community.f5.com/t5/technical-forum/http-cookie-how-can-i-handle-cookies-with-duplicate-names-but/m-p/271656 I repasted it with cleaned up formatting here. Modify the logic to match on whichever cookie names you need to modify.
when HTTP_RESPONSE { set CookieCounter 0 foreach SetCookieHeader [HTTP::header values Set-Cookie] { incr CookieCounter log local0. "Saving Set-Cookie header value in array, index number = $CookieCounter, Value = $SetCookieHeader" set CookieArray("$CookieCounter") "$SetCookieHeader" } HTTP::header remove "Set-Cookie" log local0. "Removing Set-Cookie HTTP headers" foreach {Index Cookie} [array get CookieArray] { if { $Cookie contains "iPlanetDirectoryPro" } { HTTP::header insert "$Cookie; HttpOnly" log local0. "Inserting cookie - $Cookie; HttpOnly" } else { HTTP::header insert "$Cookie" log local0. "Inserting cookie - $Cookie" } } }
The second item regarding the failing SSO, this may be related to the use of client-side Javascript that may help trigger the logon process. You might try setting each attribute separately to narrow it down, and also check with the application vendor if possible for configuration best practices.
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