Forum Discussion
Jeff_46763
Sep 11, 2012Nimbostratus
Redirect Irule for wildcard URL's
Hi all, Im working on creating an Irule for a URL that I want anything that ends in .dmz.com and .com to go to a certain URL. I attemped doing a .*, but that didn't work so well. Here's what I have if someone could please help. Im looking to redirect anything ending in .com and .lb-devdmz.abbott.com to go to the below URL.....Appreciate it.
when HTTP_REQUEST {
if {[string tolower [HTTP::host]] ends_with ".com"} {
HTTP::redirect "]"
}
}
- Kevin_StewartEmployeeboth of those host values end with ".com", so your rule should work.
- hooleylistCirrostratusHere are a couple of options:
when HTTP_REQUEST { log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::method] to [HTTP::host][HTTP::uri]" if {[string tolower [HTTP::host]] starts_with "abbott."} { HTTP::redirect "http://abbottace-d.com[HTTP::uri]" log local0. "[IP::client_addr]:[TCP::client_port]: Redirecting to http://abbottace-d.com[HTTP::uri]" } } Or when HTTP_REQUEST { log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::method] to [HTTP::host][HTTP::uri]" switch -glob [string tolower [HTTP::host]] { "abbott.*" - "*.lb-devdmz.abbott.com" { log local0. "[IP::client_addr]:[TCP::client_port]: Redirecting to http://abbottace-d.com[HTTP::uri]" HTTP::redirect "http://abbottace-d.com[HTTP::uri]" } } }
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