Forum Discussion
splavery_111804
Nimbostratus
May 22, 2008Remove port redirect from URL
Hi, newbie here with what should be an easy iRule.
We use port redirects on our http and https sites, but in some cases, the redirected port gets inserted into the URL and passed back t...
hoolio
Cirrostratus
May 22, 2008You should be able to check what the original location header value was in the /var/log/ltm log file. The above rule wouldn't have modified the protocol. If you want to change it from http:// to https://, you can modify the rule:
when HTTP_RESPONSE {
Check if a response is a redirect
if {[HTTP::is_redirect]}{
log local0. "Original Location: [HTTP::header value Location]"
Assume the server will use it's own TCP port in redirects and remove it. Also replace http:// with https://.
HTTP::header replace Location [string map -nocase [list http:// https:// ":[LB::server port]" ""] [HTTP::header value Location]]
log local0. "Updated location (string map): [string map -nocase [list http:// https:// ":[LB::server port]" ""] [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
