Forum Discussion
Ethan_West_1101
May 01, 2008Historic F5 Account
301 to Redirect
Hi All,
I am trying to get an iRule working that will redirect on a 301 to the Specific Host URI requested. This is for an application that users request is without the trailing slash (http...
hoolio
Cirrostratus
May 02, 2008If it's static strings, the change is pretty simple. Just look in responses for a 30x status, then set the Location header to a value with the app's host replaced with the outside host name.
when HTTP_RESPONSE {
Check for redirects
if {[HTTP::is_redirect]}{
Log a debug message. Comment this out when done testing.
log local0. "[IP::client_addr]:[TCP::client_port]: Updating Location header from [HTTP::header value Location], \
to: [string map -nocase {find replace} [HTTP::header value Location]]"
Replace the Location header with the new host name
HTTP::header replace Location [string map -nocase {find replace} [HTTP::header value Location]]
}
}Replace 'find' with the string you want to search for and 'replace' with the string you want to replace it with.
Aaron
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