Forum Discussion
jaikumar_f5
May 02, 2019MVP
Hi Barry,
Have seen these requirements in the past and there's been lot of solutions shared too. Don't want to reinvent the wheel, follow these links and you'll find the solutions,
Rewrite Host Header to Server IP:port
Rewrite Host Header to Server Name
You'd have to create a Data Group and an Irule for this.
Data Group:
ltm data-group internal ip_to_host_dg {
records {
1.1.1.1 {
data host1.example.com
}
1.1.1.2 {
data host2.example.com
}
1.1.1.5 {
data host3.example.com
}
}
type string
}
Irule:
when HTTP_REQUEST_SEND {
clientside {
set host_header_value [class match -value [IP::server_addr] equals ip_to_host_dg]
if {$host_header_value ne ""}{
HTTP::header replace Host $host_header_value
}
}
}
Again you can modify the host header for the http response back to the client. hope this helps.