Forum Discussion
santhana_121263
Nimbostratus
Mar 12, 2013Persist Cookie and Domain Modification iRule question
Hi,
I am newbie to F5 and I am trying to find the following iRule is valid. or How can I achieve something similar to below.
In Plain text
Browser sends a request to www....
Fabian_124018
Nimbostratus
Mar 12, 2013Here is my first ever attempt at some F5 coding learning from what you started with nitass.
Am I even close?
Fabian
[root@ve10:Active] config b virtual foo_website list
Website No.1 - https://www.foo.com.au/Login/Something
virtual foo_website {
snat automap
pool foo
destination 172.28.19.252:443
ip protocol 6
rules redirect
profiles {
clientssl {
clientside
}
http {}
tcp {}
}
}
iRule No.1 - https://www.foo.com.au/Login/Something redirecting to https://as.abc.com.au/Login/Something
[root@ve10:Active] config b rule redirect list
rule redirect {
when HTTP_REQUEST {
if { [HTTP::host] equals "www.foo.com.au" and [HTTP::uri] starts_with "/Login/Something" } {
HTTP::redirect "https://as.abc.com.au/Login/Something [HTTP::host][HTTP::uri]"
}
}
[root@ve10:Active] config b virtual abc_website list
Website No.2 - https://as.abc.com.au/Login/Something
virtual abc_website {
snat automap
pool foo
destination 172.28.19.253:443
ip protocol 6
rules setcookie
profiles {
clientssl {
clientside
}
http {}
tcp {}
}
}
iRule No.2 - If https://as.abc.com.au/Login/Something then set cookie called setRequestAuthcontext with cookie value of SOMEKEY in the *.abc.com.au domain. Once the cookie is set then redirect back to https://www.foo.com.au/TheApplication
[root@ve10:Active] config b rule setcookie list
rule setcookie {
when HTTP_REQUEST {
set mod_ck 0
if { [HTTP::host] equals "as.abc.com.au" and [HTTP::uri] starts_with "/Login/Something" } {
set mod_ck 1
HTTP::redirect "https://www.foo.com.au/TheApplication [HTTP::host][HTTP::uri]"
}
}
when HTTP_RESPONSE {
if { $mod_ck } {
HTTP::cookie insert name "setRequestAuthContxt" value SOMEKEY domain "abc.com.au"
}
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects