Forum Discussion
Feb 05, 2010
One Vs for Redirects
This should be an easy one..
I want to use one VS for a bunch of redirects, a catch all of sorts.. If for some reason this is a bad idea just let me know.
The redirect on...
Mar 02, 2010
Okayy first success, after figureing out what the string map was actually doing I re-wrote the rule like this;
when HTTP_REQUEST {
Log the request details and class contents. Need to use $:: to reference the class name here.
log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::method] to [HTTP::host][HTTP::uri]"
Check if the requested host is in the my_hosts_class datagroup
if { [matchclass [HTTP::host] equals $::my_hosts_class] } {
log local0. "Matched. Redirecting to: http://[string map -nocase {"www." ""} [HTTP::host]][HTTP::uri]"
HTTP::redirect http://[string map -nocase {"www." ""} [HTTP::host]][HTTP::uri]
} else {
HTTP::respond 200 content " Sorry, no match "
log local0. "[IP::client_addr]:[TCP::client_port]: No match"
}
}
It works for now, but it's not what i'm looking for... that locks us into specifically stripping www. from the url.. my goal is to detect any url and redirect to any url.. maybe we have to go at the irule differently?
also stacking urls works in the datagroup.. but I was under the impression the datagroup was being used to detect the url and specify the new url to redirect to... not the case... it's used to detct urls..
Thanks for all the help!!
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