Jump to content
Welcome to our new Citrix community!

Rewrite policy for POST JSON string

Recommended Posts

I have a web app that I am trying to configure SSO for. The web app uses LDAP authentication and I have created an authentication vserver with the same LDAP authentication source. The login process currently works fine but you have to enter credentials twice which is not ideal.

I have tried adding an AAA traffic policy to pass through the credentials to the page. This isn't working and I believe the reason is because the page uses a JSON script to login.

I have run a wireshark trace of a successful login and can see what is happening (see attached). On populating the username and password fields and clicking submit, there is a POST request with the following line in the body:


I have since tried adding a rewrite policy to insert the users credentials into the above JSON string and submit the POST request but I can't get the syntax correct so the NetScaler won't let me save the policy. There is very little out there on this subject so I'm really struggling to get anywhere with this.

Any help anyone can offer would be great!


Link to comment
Share on other sites

  • 6 months later...


NetScaler has the capability to parse the Json string using xp function and NetScaler can insert/Rewrite the JSON string as per customer requirement.


Please find below sample for better understanding.


If Original data is:

{ "PARENT" : {"name" : {"ganesh": "ramesh"},"C" : "abchijabc"}, "B" : "def" }


Then the config will give the response as:

{ "PARENT" : {"name" : {"ganesh": "ramesh"},"C" : "abchijabc","NEW" : "VALUE"}, "B" : "def" }


The config is:

add rewrite action ac6 insert_after "http.res.body(http.res.content_length).xpath_json_with_markup(xp%/PARENT/child::C%)" q/",\"NEW\" : \"VALUE\""/


Write back to us if you have any concerns,



Mayur P.

Link to comment
Share on other sites

  • 7 months later...
  • 6 months later...

Hi, I'm trying to select a node that matches a string and navigate to element to replace its text value, running in error -  "Unsupported XPath [launchurl%^), Offset 103]". Any suggestions? XPATH_JSON_WITH_MARKUP has little to no documentation on citrix, can someone point me to the right syntax and the functions it supports? 



Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...