Forum Discussion
CraigM_17826
May 13, 2010Altocumulus
Removing port from a redirect
Hi all,
One of our web developers has asked me if we could strip off a port number in a redirect they are doing. I thought the following would do this, but it doesn't appear to work.
...
hooleylist
May 13, 2010Cirrostratus
Hi Craig,
That should work fine to remove the port from redirects. However, the value for HTTP::header Location is cached in the same iRule event. and priority. You can get around this while testing by adding a second HTTP_REQUEST event:
when HTTP_RESPONSE {
if { [HTTP::is_redirect] } {
if { [HTTP::header Location] contains "www.acme.com:10040" } {
log local0. "Original Location value: [HTTP::header Location]"
HTTP::header replace Location [string map -nocase {www.acme.com:10400 www.acme.com} [HTTP::header value Location]]
}
}
}
when HTTP_RESPONSE priority 501 {
if { [HTTP::is_redirect] } {
Debug logging only. Remove this event once done testing
log local0. "Updated Location value: [HTTP::header Location]"
}
}
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