Forum Discussion
David_Bohls_209
Nimbostratus
Mar 03, 2011301 Redirect to different port (iRule "Rewrite Redirect"
I currently have an issue where a client of mine is producing (301 302 305 etc...) redirects for certain traffic arriving on http://www.url.com:8081. The current iRule was not set up by me, and I bel...
hoolio
Cirrostratus
Mar 03, 2011Hi David,
It doesn't make sense to replace any 30x redirect with a 301 as that tells the client and any intermediate web proxies to cache the response. As you said, you could try using the rewrite redirect option on the HTTP profile. Or you could adapt a or precise iRule:
From: http://devcentral.f5.com/wiki/default.aspx/iRules/RewriteHTTPRedirectPort.html
when HTTP_RESPONSE {
Check if server response is a redirect
if { [HTTP::header is_redirect]} {
Log original and updated values
log local0. "Original Location header value: [HTTP::header value Location],\
updated: [string map ":[TCP::remote_port]/ / http:// https://" [HTTP::header value Location]]"
Do the update, replacing :8080/ with / (where 8080 is the pool member's port) and http:// with https://
HTTP::header replace Location [string map ":[TCP::remote_port]/ / http:// https://" [HTTP::header value Location]]
}
}
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
