I am trying to use a Content Switching Action in my netscaler to replace the periods in a domain name with a hyphen.
This is how I am doing this currently;
HTTP.REQ.HOSTNAME.BEFORE_STR(".") + "-" + HTTP.REQ.HOSTNAME.DOMAIN.BEFORE_STR(".") + "-" + HTTP.REQ.HOSTNAME.DOMAIN.AFTER_STR(".")
Not only does this look really sloppy, but it only works for a 3 part domain name.
EG: it works for "site.domain.com" but not "sub.site.domain.com"
I haven't been able to find a simple .REPLACE(str, result) for the HOSTNAME or DOMAIN parts.
.PATH provides a simple to use .PATH.GET( int_path_part ), but HOSTNAME does not.
I am using version 11.0.69 Netscaler software.
What am I missing here? This seems like it should be simple to do but the Expression Editor seems to handicap my ability to do this.
RE "I haven't been able to find a simple .REPLACE(str, result) for the HOSTNAME or DOMAIN parts."
On a Rewrite Action choose type= Replace_ALL || Replace
You can either do a logical replace with regular expressions or a static replace where you simply have 1 rewrite policy / action for each application. You can also do a KV Pair type of replace where you lookup in a kv pair for what to replace