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
Yeah, you'll need the leading forward slash on the second field of the datagroup entries. Can you log the mapping in the iRule and reply with the output from /var/log/ltm?
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 } {
log local0. "Mapped [HTTP::uri] to $newURI"
HTTP::redirect "https://www.mynewsite.com$newURI"
} else {
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
}
}
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