Forum Discussion
jaddie_85451
Nimbostratus
Jun 26, 2014Redirect Loop
Hi all
New to iRules and I need help with a redirect here is what I would like to do (11.2.4 HF10)
User goes to existing site www.aaa.com
The user is redirected and presented with an informati...
Kevin_Stewart
Employee
Jun 26, 2014This is what I might do:
iRule on site A VIP:
when HTTP_REQUEST {
if { [URI::query [HTTP::uri] done] equals "1" } {
HTTP::respond 302 Location "http://[HTTP::host]/default" "Set-Cookie" "SITEA=1;path=/"
} elseif { not ( [HTTP::cookie exists SITEA] ) } {
HTTP::respond 302 Location "http://www.bbb.com/communication"
}
}
Then in your site B link back to site A, add a "done=1" query string:
[a href="http://www.aaa.com/?done=1"]Click here to continue[/a]
On first request, the URI doesn't contain the done query string and the "SITEA" cookie doesn't exist, so redirect to site B. Clicking the link at site B issues a redirect back site A, which triggers an immediate redirect back to itself and setting the SITEA cookie. All subsequent requests should bypass both conditions.
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