Forum Discussion
Rajesh_A_142089
Nimbostratus
Jan 27, 2014How to check request as result of 301
How to check if a given request on a VIP is result of a 301 temporary redirect?
John_Alam_45640
Jan 27, 2014Historic F5 Account
Append a parameter to the Location header like this:
when HTTP_RESPONSE {
If { [HTTP::is_redirect] } {
HTTP::header replace Location "[HTTP::header Location]?type=redirected"
}
}
See this: https://devcentral.f5.com/wiki/iRules.http__is_redirect.ashx
If there are already some parameters in the location header then use this instead:
HTTP::header replace Location "[HTTP::header Location]&type=redirected"Rajesh_A_142089
Nimbostratus
Jan 28, 2014Thank you John. Following your advise, I have following in my RESPONSE event where I needed to redirect the response somewhere temporarily (302) and also this is where I wanted to indicate in the redirect that it is redirect.. The result is that redirect happens but I do not see the query string in my redirect.. Please advise....Am I embading the header appropriately?
when HTTP_RESPONSE {
if { $is_sourcehost and [HTTP::status] == 404 } {
HTTP::header replace Location "[HTTP::header Location]?type=redirected"
HTTP::respond 302 noserver Location "https://temlocation.mydomain.com$uri"
}
}
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