Forum Discussion
al_kabeer_2905
Nimbostratus
Mar 25, 2013IRule to remove server banner from header reply
hi,
i have 2 webservers, having VIP, i want to remove the server name ( server banner) from response of F5.
thanksssssss
Brian_Kenworthy
Nimbostratus
May 07, 2013Hi Guys, I stumbed across this thread and wanted to ask if there was an easy way to remove the Server: BigIP from the response header. I am actually using an iRule, based on Server Resource Cloaking wiki (https://devcentral.f5.com/wiki/iRules.ServerResourceCloaking.ashx) but BigIP still returns the Server header even though it is not listed in the preserve list.
I also found this link about using the HTTP::Respond but I'm not sure how this would impact my application (https://devcentral.f5.com/wiki/iRules.http__respond.ashx)
Here is my iRule:
when RULE_INIT {
Create a list of the response headers to preserve. This needs to be tailored to the application!
set static::headers_to_preserve [list \
Accept-Range \
Cache-Control \
Content-Encoding \
Content-Length \
Content-Type \
Etag \
Last-Modified \
Pragma \
Set-Cookie \
Location \
Content-Disposition \
Transfer-Encoding \
Content-Security-Policy \
Strict-Transport-Security \
X-Content-Type-Options \
X-Frame-Options \
X-XSS-Protection \
X-Content-Security-Policy \
]
Log debug messages to /var/log/ltm? 1=yes, 0=no.
set static::clocking_debug 0
}
when HTTP_RESPONSE {
Remove all headers but those in the preserve list
foreach aHeader [HTTP::header names] {
if {not ([matchclass $static::headers_to_preserve equals $aHeader])}{
if {$static::clocking_debug}{log local0. "Removing: $aHeader: [HTTP::header value $aHeader]"}
HTTP::header remove $aHeader
}
}
}
Thanks in advance for your help!
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
