Forum Discussion
irule tcl error Operation not supported.
- Oct 06, 2014
Hi Gilbert,
Your problem is that you have TWO qualifying events:
-
if {[string tolower [HTTP::host]] eq "mysite.com"
-
if { ([string tolower [HTTP::host]]) contains "mysite.com"
You can do this, but you must force processing to stop after the first event. So in your case if the incoming request is for http://mysite.com you want to redirect it to http://www.mysite.com. After the redirect it will not qualify for this first event because the HTTP::host value will be www.mysite.com and not mysite.com.
You can do this with the "break" command which will tell the iRule to STOP Processing anything else in this iRule.
As Rolf pointed out you were had an error on one of your lines "::redirect" should be "HTTP::redirect" and I also saw a pool command that did not belong in the switch statement.
See if this helps:
when HTTP_REQUEST { if {[string tolower [HTTP::host]] eq "mysite.com" } { HTTP::redirect "https://www.mysite.com[HTTP::uri]" log local0. "adding www" break } if { ([string tolower [HTTP::host]]) contains "mysite.com" } { switch -glob -- [string tolower [HTTP::uri]] { "paymentprocessorv3" - "paymentprocessorakc" { pool IIS_ECM.mysite.com_pool } "/autodiscover/autodiscover.xml" { HTTP::redirect "https://autodiscover.mysite.com/AutoDiscover/AtoD iscover.xml" } "/public/hrresume.nsf" { HTTP::redirect "https://mysitecareers.silkroad.com" } default { pool mysiteDNN } } } }
-
Hi Gilbert,
Your problem is that you have TWO qualifying events:
-
if {[string tolower [HTTP::host]] eq "mysite.com"
-
if { ([string tolower [HTTP::host]]) contains "mysite.com"
You can do this, but you must force processing to stop after the first event. So in your case if the incoming request is for http://mysite.com you want to redirect it to http://www.mysite.com. After the redirect it will not qualify for this first event because the HTTP::host value will be www.mysite.com and not mysite.com.
You can do this with the "break" command which will tell the iRule to STOP Processing anything else in this iRule.
As Rolf pointed out you were had an error on one of your lines "::redirect" should be "HTTP::redirect" and I also saw a pool command that did not belong in the switch statement.
See if this helps:
when HTTP_REQUEST {
if {[string tolower [HTTP::host]] eq "mysite.com" } {
HTTP::redirect "https://www.mysite.com[HTTP::uri]"
log local0. "adding www"
break
}
if { ([string tolower [HTTP::host]]) contains "mysite.com" } {
switch -glob -- [string tolower [HTTP::uri]] {
"paymentprocessorv3" -
"paymentprocessorakc" {
pool IIS_ECM.mysite.com_pool
}
"/autodiscover/autodiscover.xml" {
HTTP::redirect "https://autodiscover.mysite.com/AutoDiscover/AtoD iscover.xml"
}
"/public/hrresume.nsf" {
HTTP::redirect "https://mysitecareers.silkroad.com"
}
default { pool mysiteDNN }
}
}
}
- Gill_32697Oct 06, 2014NimbostratusOk yes, I see. I'll test this on our next change window. Thanks Guys.
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