Posted in : Azure, NetScaler By Simon Gottschlag Translate with Google ⟶

4 years ago

A few days ago, I wrote a blog post about Using Citrix ingress controller with Azure Kubernetes Service. In this post, I’m going to show how easy it is to use the Custom Resource Definitions from Citrix to replace the Server header in an HTTP response, as well as removing it completely.
If you would like to know more about Custom Resource Definitions, see the Custom Resources documentation on kubernetes.io. If you want to know more about what you can do with them from Citrix, see this developer documentation Using Rewrite and Responder policies in Kubernetes.
If you deploy the example I’ve used in my blog post, you should have a few apache PODs up an running. These will be using a Server header looking something like this:
Apache Server Header
In our first example, we will rewrite it to show as asterisks instead of Apache:

apiVersion: citrix.com/v1
kind: rewritepolicy
metadata:
  name: rewriteserverheader
spec:
  rewrite-policies:
    - servicenames:
        - apache
      rewrite-policy:
        operation: replace
        target: 'HTTP.RES.HEADER("Server")'
        modify-expression: '"****"'
        comment: 'Rewrite HTTP Response Server header'
        direction: RESPONSE
        rewrite-criteria: 'HTTP.RES.HEADER("Server").EXISTS'

When this is applied, you will see the following instead:
Apache Server Header Rewritten
You can also remove it completely, by using the following example instead to delete the header:

apiVersion: citrix.com/v1
kind: rewritepolicy
metadata:
  name: deleteserverheader
spec:
  rewrite-policies:
    - servicenames:
        - apache
      rewrite-policy:
        operation: delete_http_header
        target: 'Server'
        comment: 'Delete HTTP Response Server header'
        direction: RESPONSE
        rewrite-criteria: 'HTTP.RES.HEADER("Server").EXISTS'

And now will it instead be deleted:
Apache Server Header Deleted
These are just two easy examples of how you can get the cloud native experience using Citrix ADC CPX and the Citrix ingress controller.
Feel free to comment here or on GitHub if you have any questions or feedback!

Tags : AKS, Azure Kubernetes Service, CIC, Citrix ADC, Citrix ingress controller, CPX, delete, http header, Kubernetes, NetScaler, rewrite, server header

Personlig rådgivning

Vi erbjuder personlig rådgivning med författaren för 1400 SEK per timme. Anmäl ditt intresse i här så återkommer vi så snart vi kan.

Add comment

Your comment will be revised by the site if needed.