I’m trying to setup an irule which removes the HTTP header in the response for http to https redirects. At the moment we can see Server:BigIP within the response and would like it removed. I’ve appended the following HTTP_RESPONSE to the HTTP2HTTPS rule but it’s still not working:
when HTTP_RESPONSE {
if {[HTTP::is_redirect]} {
if {[HTTP::header Server] contains “BigIP” } { HTTP::header replace Server “www.servername.com” } } }
At the moment this rule appears to be ignored. I’ve added a log to the rule and it’s not being shown in the actual log so it seems to process the http request but not the http response. I’ve tried 2 seperate irules but it’s not working either. The HTTP_REQUEST rule I’m using is
when HTTP_REQUEST { HTTP::redirect https://[getfield [HTTP::host] “:” 1][HTTP::uri] }
Any ideas? Is it possible conditions arent being met in the http_reponse which is why it is being ignored?
Hi Kevin, Thanks for that. I’ve tried a few of the suggestions in the article but still cant get it to work. I tried the following HTTP_REQUEST: HTTP::respond 302 noserver Location “https://[HTTP::host][HTTP::uri]” and it works sometimes but every 3rd/4th test, it shows up the server name again. I also tried
when HTTP_REQUEST { set my_loc “https://[HTTP::host][HTTP::uri]” TCP::respond "HTTP/1.1 302 Found\r\n Location: $my_loc\r\n Connection: Keep-Alive\r\n Content-Length: 0\r\n " TCP::close } and it didnt work at all. Any other suggestions would be much appreciated.
try the “noserver” option of HTTP::respond and add the original Server via “Header Name” “Header Value”.
Note: The noserver flag was added in 9.4.2. It suppresses the insertion of the ‘Server: BigIP’ header. The noserver flag must be included after the content (if any).