Forum Discussion

John_Stevensen's avatar
John_Stevensen
Icon for Nimbostratus rankNimbostratus
Sep 20, 2017

IF http::host NOTEQUALS? Whats the correct way to do this?

I apologize but the formatting is not showing properly.

Im trying to find the "right way" to write this iRule - but I cannot confirm there is a "not equal" that exists....

when HTTP_REQUEST {

 if { ([HTTP::host] notequals "orders.widgets.com") } {
   HTTP::redirect "https://orders.widgets.com/redirectpage.html"
 }

}

The reasoning for this is that we had a * (wildcard) cert and we are trying to get everyone off to use the main page. If they are not coming in on the main page as we have asked them - they will be redirected to a redirect warning page - hold there for 10 seconds and then the server (pool member) will redirect them to the appropriate page.

2 Replies

  • Hi,

    The right syntax is

    ne
    To compare strings

    when HTTP_REQUEST {
    
     if { ([HTTP::host] ne "orders.widgets.com") } {
       HTTP::redirect "https://orders.widgets.com/redirectpage.html"
     }
    }