Forum Discussion
Jamshid_40364
Nimbostratus
Jun 02, 2010Rule to automatically "follow" an internal redirect?
Hi, I'm new to iRules. I see the example of detecting a redirect and rewriting the Location header:
http://devcentral.f5.com/Tutorials/TechTips/tabid/63/articleType/ArticleView/articleId/220/Rewriti...
hoolio
Cirrostratus
Jun 02, 2010Hi Jamshid,
Sure.. there's an example on the HTTP::retry wiki page you could adapt:
http://devcentral.f5.com/wiki/default.aspx/iRules/http__retry
One can save a WAN round trip by following a redirect at the LTM and responding to the
original client request with the result of the redirect
when HTTP_REQUEST {
Save the host header value
set host [HTTP::host]
}
when HTTP_RESPONSE {
Check if response is a redirect based on the status code
if { [HTTP::is_redirect] } {
Now generate a GET request to the new location
HTTP::retry "GET [HTTP::header location] HTTP/1.1\r\nHost: $host\r\n\r\n"
}
}
Aaron
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