Forum Discussion

Gill_32697's avatar
Gill_32697
Icon for Nimbostratus rankNimbostratus
Oct 06, 2014

irule tcl error Operation not supported.

Started getting these log errors when I added the IF to force WWW, below is a shortened version id the iRule.....not sure how to fix ! !-- Error below ! Mon Oct 6 09:50:41 CDT 2014 err tmm tmm[6950] ...
  • Michael_Yates_6's avatar
    Oct 06, 2014

    Hi Gilbert,

    Your problem is that you have TWO qualifying events:

    1. if {[string tolower [HTTP::host]] eq "mysite.com"

    2. 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 }
          }
       }
    }