A few weeks ago my colleague informed me you can customize the NetScaler Gateway portal by using rewrite/response policies to edit the HTML code footer area . You can use this option to make important announcements or a disclaimer. In this blog post I will show you how to do this.

NetScaler management GUI

For the non-command line guru’s we configure this first via the management GUI.

Go to AppExpert -> Rewrite -> Actions -> Add

Create a new Rewrite action as seen in the example screenshot:

NS-rewrite-response-3
Rewrite Action
  • Name: Fill in a policy name
  • Type: INSERT_BEFORE_ALL
  • Expression to choose target location: HTTP.RES.BODY(120000).SET_TEXT_MODE(IGNORECASE)
  • Expression (example): Download link
  • Pattern: box_view.prepare_view();
  • OK (Close)

Next, we make a Rewrite Policy.

Go to AppExpert -> Rewrite -> Policies -> Add

NS-rewrite-response-5
Rewrite Policy
  • Name: Fill in a name
  • Action: Select the previous created Action
  • Undefined-Result Action: -Global-undefined-result-action-
  • Expression: HTTP.REQ.URL.CONTAINS(\”gateway_login_view.js\”)
  • OK (Close)

Next, we add the newly created Rewrite Policy to our NetScaler Gateway vServer.

Edit your vServer and add a Rewrite/Response policy.

NS-rewrite-response-13
Add Rewrite/Response Policy

 

And here is the end result:

NS-rewrite-response

Command-line

Here are the command-line options to configure this.

WordPress messes up the output. Here is the download link example.

Credits: http://tech.stelte.nl