Forum Discussion
Irule Vs rewrite - FQDN hostname
HTTP::redirect will effectively redirect the client to the new location, and will change the url in the browser. What you need is to replace the host header in the pool side of the connection as described here https://clouddocs.f5.com/api/irules/HTTP__host.html
when HTTP_REQUEST {
# Check if requested host doesn't start with www.example.com
if {not ([string tolower [HTTP::host]] starts_with "www.example.com")}{
# Replace the host header value with newhost.example.com
HTTP::header replace Host "newhost.example.com"
}
}
And to replace the path with another path without redirection, this is described here https://my.f5.com/manage/s/article/K02027845 :
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/sometext" } {
set uri [string map -nocase {"/sometext" "/newtext"} [HTTP::uri]]
HTTP::uri $uri
}
}
Hi Amine_Kadimi
Would I create 2 separate irules?
- Amine_KadimiFeb 23, 2023MVP
Sorry for the ambiguous reply. No you can do it with one iRule and one when HTTP_REQUEST block containing all the replacement logic you need.
Two iRules can work too but there is no need to go this way in your case.
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