Forum Discussion

Bob_10976's avatar
Bob_10976
Icon for Nimbostratus rankNimbostratus
May 05, 2010

Rejecting Blank Host

Hello all, we have created an iRule that is suppose to block request to a website with no Host Header. I've included the code below. The rule appears to be working, but we are getting the following error in the BigIP log files:

 

 

TCL error: BlockNoHeader - expected integer but got "reject" while executing "HTTP::respond reject"

 

 

The iRule consist of this:

 

when HTTP_REQUEST {

 

if { [HTTP::host] equals "" } {

 

HTTP::respond reject }

 

}

 

 

Any thoughts or suggestions, maybe we could be doing the block method better?

 

 

Thanks,

 

Bob

6 Replies

  • Hi Bob,

     

     

    If you want to send a TCP reset to the client you can change HTTP::respond reject to just reject.

     

     

    Aaron
  • Thanks for the quick reply Aaron.. Just to clarify the rule would look like this:

     

     

    when HTTP_REQUEST {

     

    if { [HTTP::host] equals "" } {

     

    reject }

     

    }

     

     

    Thanks,

     

    Bob
  • At first I thought that did the trick because I didn't see anything in this mornings logs. I checked yesterdays logs and I can see: local/tmm err tmm[4820]: 01220001:3: TCL error: Test_BlockNoHeader - expected integer but got "reject" while executing "HTTP::respond reject"

     

     

    Any thoughts?
  • Hi Bob,

    I assume you were getting that error from the original version of the iRule. Have you tried testing with this version which doesn't use HTTP::respond?

    
    when HTTP_REQUEST {
       if { [HTTP::host] equals "" } {
          reject
       }
    }
    

    Aaron
  • Yes, I get the same error when I use the excat code above. Does it matter that I'm running 10.0.1 on my LTMs, would the iRule require a different syntax or something?

     

     

    Thanks,

     

    Bob