Forum Discussion
DM_5174
May 23, 2011Nimbostratus
merging two irules into one efficient one.
Hi All,
I was wondering if there is a way to merge two irules into one effcient one. The first irule checks the host
and if a user is coming in as www.mysite.com, it will rewrite the host head...
hooleylist
May 23, 2011Cirrostratus
So maybe something like this?
when HTTP_REQUEST {
Check if the Host is www.mysite.com
if { [string tolower [HTTP::host]] eq "www.mysite.com"} {
Rewrite the Host header to www.mynewsite.com
HTTP::header replace Host "www.mynewsite.com"
} else {
look for the second string in the data group and redirect
set newURI [findclass [HTTP::uri] $::newURI-Datagroup " "]
if { "" ne $newURI } {
HTTP::redirect "https://www.mynewsite.com$newURI"
} else {
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
}
}
If you're having issues with the redirects, can you post an anonymized copy of the datagroup contents from the bigip.conf? Please also note a couple of URIs which do and don't work.
Aaron
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