Forum Discussion
Rewrite the post operation with a body.
- Sep 22, 2023
Hi Kerry/JRalm;
The issue resolved when i changed pool members from DEX to NGINX (using the same irule) since rewrite host name locate in NGINX. Thanks a lot for your support.
Hi Hien_Truong, it looks like you just need to rewrite the host header inbound? If you want this to be fairly dumb, you can do something like:
when HTTP_REQUEST {
if { [HTTP::host] == "abc-cd.ef.com" } {
HTTP::header replace Host "cd.ef.com"
}
}
If it needs to be dynamic, there are multiple options depending on what the patterns would be. I'll assume a pattern of: nnn-cd.ef.com for the following solution:
when HTTP_REQUEST {
# assumes that port 80 is used for http or 443 for https
# if non-std ports, use contains instead of ends_with
if { [HTTP::host] ends_with "-cd.ef.com" } {
HTTP::header replace Host [getfield [HTTP::host] "-" 2]
}
}
If this is not the actual pattern of your hosts that you want to manipulate, post back and we can work on an alternative. untested, make sure to do so in a lab.
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