HTTP::respond 405 still sends server header

I’m using an iRule to protect some services. One thing I am filtering on is the method.

Below is my basic rule. However the problem is that when it does it’s thing it doesn’t appear

to be obeying the “noserver” argument. This rule:

when RULE_INIT {
  set allowed_http_methods [list "GET" "POST" "Head"]
}

when HTTP_REQUEST {
  set uri [string tolower [HTTP::uri]]

  if { not ([matchclass [HTTP::method] equals $::allowed_http_methods]) } {
    HTTP::respond 405 noserver
  }
}

Still produces this output:

REQUEST: **************\n
TRACE / HTTP/1.1\r\n
Host: my.site.com\r\n
Accept: */*\r\n
\r\n
RESPONSE: **************\n
HTTP/1.0 405 Method Not Allowed\r\n
Server: BigIP\r\n
Connection: Keep-Alive\r\n
Content-Length: 0\r\n
\r\n

Any thoughts?

Hi Gorf,

You can also use HTTP::header sanitize in the HTTP::header Command

But try this in your current iRule:

HTTP::respond 405 content " " noserver

what version are you running?

[root@iris:Active] config  b version|grep -iA 1 version
BIG-IP Version 10.2.3 112.0
Final Edition
[root@iris:Active] config  b virtual bar list
virtual bar {
   snat automap
   pool foo
   destination 172.28.17.33:http
   ip protocol tcp
   rules myrule
   profiles {
      http {}
      tcp {}
   }
}
[root@iris:Active] config  b rule myrule list
rule myrule {
   when HTTP_REQUEST {
   HTTP::respond 405
}
}
[root@iris:Active] config  curl -I http://172.28.17.33
HTTP/1.0 405 Method Not Allowed
Server: BigIP
Connection: Keep-Alive
Content-Length: 0

[root@iris:Active] config  b rule myrule list
rule myrule {
   when HTTP_REQUEST {
   HTTP::respond 405 noserver
}
}
[root@iris:Active] config  curl -I http://172.28.17.33
HTTP/1.0 405 Method Not Allowed
Connection: Keep-Alive
Content-Length: 0