In certain cases, we do not want to parse the HTTP headers to the end Client. NetScaler can do this job by deleting the HTTP header received from the Server. We can use Rewrite feature of NetScaler to achieve this.
Configuration > AppExperts > Rewrite.
Step 1: To remove HTTP header named "Server"
CLI commands:
add rewrite action Server_header_remove_action delete_http_header Server
add rewrite policy Server_header_remove true Server_header_remove_action
Step 2: To remove HTTP header named "X-Powered-By"
CLI commands:
add rewrite action Powered_remove_action delete_http_header X-Powered-By
add rewrite policy Powered_header_remove true Powered_remove_action
Step 3 : Bind this Rewrite policy to the desired Virtual Server.
bind lb vserver <LB_VServer_name> -policyName Server_header_remove -priority 100 -gotoPriorityExpression NEXT-type RESPONSE
bind lb vserver <LB_VServer_name> -policyName Powered_header_remove -priority 100 -gotoPriorityExpression END -type RESPONSE
Since we need to remove both the Headers in Response, the expression is "true" for the two policies. Also, since we need both the policies to be evaluated to delete the headers, the GoToExpression should be set to NEXT for ofirst policy.