Forum Discussion
abachman_72712
Nimbostratus
Aug 12, 2009Redirect to URL
Attempting to script an iRule a redirect statement for a URL, but I cannot get the iRule statement to take. We would like users to type in the browser http://testsite, and have them redirected to http://testsite/test/sitedoc.do. I need to add this statement into the already existing iRule that is attached to a persistence profile.
when CLIENT_ACCEPTED {
set add_persist 1
}
when HTTP_RESPONSE {
if { [HTTP::cookie exists "JSESSIONID"] and $add_persist } {
persist add uie [HTTP::cookie "JSESSIONID"]
set add_persist 0
}
}
when HTTP_REQUEST {
if { [TCP::local_port] == 80 }{
HTTP::redirect http://testsite/test/sitedoc.do
}
if { [HTTP::cookie exists "JSESSIONID"] } {
persist uie [HTTP::cookie "JSESSIONID"]
} else {
set jsess [findstr [HTTP::uri] "jsessionid" 11 ";"]
if { $jsess != "" } {
persist uie $jsess
}
}
if {not ([HTTP::uri] starts_with "/ClaimCenter/ClaimCenter.do")}{
HTTP::uri "/ClaimCenter/ClaimCenter.do[HTTP::uri]"
}
}
{
}
}
Any help would be appreciated
1 Reply
- abachman_72712
Nimbostratus
The last few lines of the previous iRule were removed, and should not have been there. Here is the real syntax of the iRule being applied.
when CLIENT_ACCEPTED {
set add_persist 1
}
when HTTP_RESPONSE {
if { [HTTP::cookie exists "JSESSIONID"] and $add_persist } {
persist add uie [HTTP::cookie "JSESSIONID"]
set add_persist 0
}
}
when HTTP_REQUEST {
if { [TCP::local_port] == 80 }{
HTTP::redirect http://testsite/test/sitedoc.do
}
if { [HTTP::cookie exists "JSESSIONID"] } {
persist uie [HTTP::cookie "JSESSIONID"]
} else {
set jsess [findstr [HTTP::uri] "jsessionid" 11 ";"]
if { $jsess != "" } {
persist uie $jsess
}
}
}
{
}
}
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
