Forum Discussion
hooleylist
Nov 18, 2010Cirrostratus
If you need to use the hostname that resolves to the virtual server instead of the IP, you could use an iRule like this:
http://devcentral.f5.com/wiki/default.aspx/iRules/RewriteHTTPRedirectHostname.html
when HTTP_REQUEST {
Save host name (use VS IP if no HTTP host header was found
if {[HTTP::host] eq ""}{
set host [IP::local_addr]
} else {
set host [HTTP::host]
}
}
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 -nocase "http:// https:// [IP::server_addr] $host" [HTTP::header value Location]]"
Do the update, replacing http:// with https:// and the server IP with the host or VS IP
HTTP::header replace Location [string map -nocase "http:// https:// [IP::server_addr] $host" [HTTP::header value Location]]
}
}
Aaron