Forum Discussion
policy to replace host value
Andrew
I finally got it working with the below irule but trying to add multiple urls in the request and not getting my syntax correct for the http response. Any help appreciate it.
when HTTP_REQUEST {
set external_hostname "tools.xyz.com"
set internal_hostname "tools.abc.com"
set external_hostname1 "test.xyz.com"
set internal_hostname1 "test.abc.com"
if { ([HTTP::host] equals $external_hostname) } {
HTTP::header replace Host $internal_hostname
}
if { ([HTTP::host] equals $external_hostname1) } {
HTTP::header replace Host $internal_hostname1
}
}
when HTTP_RESPONSE {
set external_hostname "tools.xyz.com"
set internal_hostname "tools.abc.com"
set external_hostname1 "test.xyz.com"
set internal_hostname1 "test.abc.com"
log local0. "The location header [HTTP::header Location] on response"
HTTP::header replace Location [string map -nocase "$internal_hostname $external_hostname" [HTTP::header Location]]
HTTP::header replace Location [string map -nocase "$internal_hostname1 $external_hostname1" [HTTP::header Location]]
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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