Forum Discussion
Removing the server name from the response header of F5
Hi,
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?
Thanks in advance.
6 Replies
- Kevin_Stewart
Employee
Please take a look here some good answers:
- ucirl_161922
Nimbostratus
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.
Thanks in advance.
- Kevin_Stewart
Employee
Curious why the first fails. Are all of these redirects coming from this one HTTP::respond?
- R_Eastman_13667Historic F5 Account
Try this:
if {[HTTP::header value "Server"] contains "BigIP" } { HTTP::header replace Server "www.servername.com" } } } - Wand_97484
Nimbostratus
try the "noserver" option of HTTP::respond and add the original Server via "Header Name" "Header Value".
https://devcentral.f5.com/wiki/iRules.HTTP__respond.ashx
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).
- Juraj
Cirrus
In the latest version (v12.1.2 at this moment), you can get rid of
by either editing the defaultServer: BigIP
profile (not recommended), or creating a new one by inheriting thehttp
profile (preferred), and then replacing/deletinghttp
in the profile.Server Agent Namefrom config:
ltm profile http my_http_profile { app-service none defaults-from http proxy-type reverse server-agent-name none }Server Agent Name: Specifies the string used as the server name in traffic generated by LTM. The default value is BigIP.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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