Part 2: Learn How to Customize the New NetScaler Receiver for Web UI (RfWebUI) Theme
As we discussed in Part 1 of this post, there are three categories of NetScaler customizations:
1) Customizations that do not require any rewrite policies/actions (“policies”) or source code modifications (“modifications”),
2) Customizations that can be accomplished using either policies or modification, and
3) Customizations that will most probably need modification of the source code.
In Part 1, we focused on the Default, Green Bubble, and X1 (the "original") themes. In part 2, we will discuss the newest theme - Receiver for Web UI (RfWebUI), which uses a completely new mechanism.
While the logon page of the theme looks like the X1 theme:
... don't let it fool you. If you will be using this theme, you can forget pretty much everything you've learned about customizing the NetScaler logon page.
Let's begin with the location of the logon page. When using the original themes, the logon page (index.html) is served from the /netscaler/ns_gui/vpn/ directory. With the RfWebUI theme, the file is served from /var/netscaler/logon/LogonPoint/. The good news is that since the page is now in the /var partition, any modifications to the page (or copies of the logon page) are automatically persisted across a reboot. No longer do you need to add lines to rc.netscaler to copy modified files into the flash partition.
The next major change is how you modify text. The portal wizard allows you to easily make changes to commonly updated text. Let's say you wanted to change the labels on the logon screen. After clicking OK at the bottom of the wizard, you will then be prompted for the language you wish to use:
After clicking OK, you will see the pages you can modify on the right-hand side of the page.
Click Login Page. You are presented with the default labels for the page:
Let's modify them as follows:
Finally, click Done. Now, let's refresh the page (you may need to clear your cache).
If you've had experience customizing the original NetScaler themes, at this point you are probably thinking, "Tell me something that I don't already know ... this is no different than modifying any of the other themes!" Not quite ... The portal wizard functions differently depending on which theme has been chosen. For the original themes, the portal wizard would modify the values in the .xml file in the resources directory (e.g. /var/netscaler/logon/themes//resources/en.xml). The keys affected are located under the Partition ID of Logon. Now, what if you wished to modify the text of the logon button above, which you can't do from the portal wizard? No problem. In the same file, as few lines down, we find:
Simply change it to:
Click to log on
... and then save the file.
Try that with a theme based on RfWebUI and you will find that it doesn't work. In fact, if you look at the .xml file in the resources directory of a RfWebUI-based theme, you will notice that the portal wizard did *not* modify ANY of the keys in that file. What gives??
For RfWebUI-based themes, those text changes are written to /var/netscaler/logon/themes/<theme>/strings..json:
While the portal wizard writes all the values on a single line. I would suggest placing each override on a separate line for readability and maintainability. Also note that this "key":"value" format differs from the XML format of the other themes.
In order to change other text elements on the page, you will need to get the key to be placed in the override file. The keys may be found in the file /var/netscaler/logon/LogonPoint/receiver/js/localization//ctxs.strings.js. The key for the logon button is nsg_LogOnbutton. Let's add an override for it to the above file:
Then save the file, and refresh the page. In addition to clearing the cache on your PC, it may take 2-3 minutes for the cache to be cleared on the NetScaler.
Now, let's try to add our own custom text fields as we did with the X1 theme in Part 1.
Here we come to another major difference. In the original themes, we would:
- Add a
with a unique id (either via a rewrite action/policy or a modified gateway_login_form_view.js file),
- Add a string with the
's id to the XML file in the resources directory, and finally
- Add a CSS selector with the
's id to the custom.css file in the selected theme.
Note that everything is keyed off the id of the
With RfWebUI-based themes, text is keyed off of class names, and the class name must begin with _ctxstxt_. So, to add the "authorized users only" warning (see Part 1), we make a copy of the index.html file (let's call it custom.html), and add our custom
We then add an entry with the text into strings.en.json (without the _ctxstxt_ prefix):
We also need to add style information, but instead of adding it to custom.css, for RfWebUI-based themes, it must go into theme.css. Here you can either use the
's id (if specified), or the full class name (including the _ctxstxt_ prefix).
We can test by browsing to our custom.html file.
Let's not forget our footer ... add another custom
Then add the text:
... and then the CSS:
Browsing to our custom page:
Our final step is to create a responder policy and bind it to our AG vServer. This will automatically invoke our custom page when we browse to the AG vServer FQDN:
> add responder action "Logon Page Redirect Action" redirect "\"custom.html\"" -responseStatusCode 302
> add responder policy "Logon Page Redirect Policy" "HTTP.REQ.URL.PATH_AND_QUERY.CONTAINS(\"LogonPoint/index.html\")" "Logon Page Redirect Action"
> bind vpn vserver "AG vServer" -policy "Logon Page Redirect Policy" -priority 100 -gotoPriorityExpression END -type REQUEST
> save config
To remove the customizations, simply unbind the responder policy.
Important: Make sure to keep backup copies of all files. Re-running the portal wizard will wipe out any manual updates that you have made to the files.
Here is a handy cheat-sheet summarizing all of the above:
Thanks to the NetScaler development team for their assistance, especially Bidyut H.
Sam Jacobs is the Director of Technology Development at IPM, the longest standing Citrix Platinum Partner on the East Coast. With more than 25 years of IT consulting, Sam is a NetScaler customizations and integrations industry expert. He holds Microsoft MCSD, Citrix CCP-M and CCP-N certifications, and is the editor of TechDevCorner.com, a technical resource blog for IT professionals. He is one of the top Citrix support Forum contributors, and has earned industry praise for the tools he has developed to make NetScaler, StoreFront and Web Interface easier to manage for administrators and more intuitive for end users. Sam became a Citrix Technology Professional (CTP) in 2015. Sam can be reached at: email@example.com or on Twitter at: @WIGuru.