CraigM_17826
May 13, 2010Altostratus
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.
when HTTP_REPSONSE {
if { [HTTP::is_redirect] } {
if { [HTTP::header Location] contains "www.acme.com:10040" } {
log "Original Location value: [HTTP::header Location]"
HTTP::header replace Location [string map -nocase {www.acme.com:10400 www.acme.com} [HTTP::header value Location]]
log "Updated Location value: [HTTP::header Location]"
return
}
}
}
And here is what is written to the log
Original Location value: www.acme.com:10040/secure/discussion-forum
Updated Location value: www.acme.com:10040/secure/discussion-forum
Note: actually the log includes http but if I enter in a URL in this new forum s/w it does odd things to it.
Any help appreciated. Craig