The values for most HTTP:: commands are cached within the same event and priority. If you don't specify an event priority a default of 500 is used. You can use a later priority event (like 501) to view the change from the iRule. Also, the curly braces in string map will prevent command and variable substitution. You can use double quotes instead:
...
if { [HTTP::is_redirect] } {
log local0. "Original Location: [HTTP::header value Location]"
HTTP::header replace Location [string map -nocase "[URI::host [HTTP::header value Location]] def.example.com" [HTTP::header value Location]]
}
}
when HTTP_RESPONSE priority 501 {
log local0. "Updated Location: [HTTP::header value Location]"
}
Aaron