Forum Discussion
Mr__T
Cirrus
Sep 19, 2023Replace server name
Hello All, I am looking to replace the FQDN of a URL with the server name keeping the remainder of the URL after the FQDN. Trying to find the simplest way to acheive this. Dont want to redirect the ...
JRahm
Admin
Sep 19, 2023Hi Mr__T so you are just wanting to rewrite the Host header in the communication from client->BIG-IP->server, but not issue a redirect, correct? You can do that in an LTM policy or in an iRule.
Policy
ltm policy host_rewrite {
last-modified 2023-09-19:14:47:44
requires { http }
rules {
host_rewrite_all_traffic {
actions {
0 {
http-header
replace
name Host
value new.fqdn.com
}
}
}
}
status published
strategy first-match
}
iRule
when HTTP_REQUEST priority 500 {
HTTP::header replace host "new.fqdn.com"
}
Note that this is not rewriting the location headers being returned from the server, and is assuming they are a) returning the original fqdn and b) are fine receiving a rewritten host. If that's the not the case, you'll need to do some more work. Post back with more details if necessary. HTH...Jason
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects
