• View Communities
    • Citrix Developer Network
      The place for unfiltered straight talk on Citrix products. Blogs, code downloads, best practices, APIs, and more can all be found here.
    • Citrix Ready Community Verified
      Does it work with Citrix? Application compatibility questions are a thing of the past with the new Citrix Community Verified site.
    • Blogs
      Learn the latest from the Citrix employees who are building application delivery infrastructure technologies.
    • Blogosphere
      The Citrix Blogosphere is a window into the thousands of conversations taking place about Citrix and Application Delivery.
  •  Sign In
NetScaler Developer Network

Prebody and Postbody Files

Brief overview of the prebody and postbody files used for HTTP Body Injection. Also, sample prebody and postbody files.

Summary

Configuring Prebody Files

Content injected before the response body is called the prebody content. To insert content into the response prebody, you need to create a separate prebody file on the system with the content you want injected.

By default, prebody files are stored in the /nsconfig/htmlinjectiondirectory on the system. However, you can store them in any other location you prefer. The prebody file name can have a maximum of 64 characters and can have any extension.

The following is a sample prebody file to be used for prebody insertion.

Sample prebody file: /nsconfig/htmlinjection/prebody.js

<!- This is a sample prebody file ->

<script language="JavaScript">

// Internal variables are delimited by the percent characters

/* The following two variables must be quoted.

* Otherwise browser may give a JavaScript error.

*/

// System IID

var sys_iid="%%SYS.IID%%";

// HTTP transaction ID

var http_xid="%%HTTP.XID%%";

/* Following timestamp variables will always be valid

* when prebody is injected (When we get the initial

* bytes of server response).

*/

// Client request timestamps

var clt_req_beg=%%HTTP.REQ.RECEIVE_TIME_BEG%%;

var clt_req_end=%%HTTP.REQ.RECEIVE_TIME_END%%;

// Netsclaer to server request timestamps

var ns_req_beg=%%HTTP.REQ.SEND_TIME_BEG%%;

var ns_req_end=%%HTTP.REQ.SEND_TIME_END%%;

</script>

Configuring Postbody Files

Content injected after the response body of a response is called the postbodycontent. To insert content into the response postbody, you must need to create a separate postbody file on the system, containing with the content you want injected.

Postbody files are stored by default in the/nsconfig/htmlinjection directory on the system by default. However, they can be stored in any other location of your choice. The postbody file name can have a maximum of 64 characters and can have any extension.

The following is a sample postbody file created on the system that will be used for postbody injection.

Sample postbody file: /nsconfig/htmlinjection/postbody.js

<!- This is a sample postbody file ->

<script language="JavaScript">

// Internal variables are delimited by the percent characters

/* The following two variables must be quoted.

* Otherwise browser may give a JavaScript error.

*/

// System IID

var sys_iid="%%SYS.IID%%";

// HTTP transaction ID

var http_xid="%%HTTP.XID%%";

/* Following timestamp variables are guaranteed to be

* valid only when we get the last byte of response

* (That is, when we are injecting postbody).

*/

// Server response timestamp variables

var server_res_beg=%%HTTP.RES.RECEIVE_TIME_BEG%%;

var server_res_end=%%HTTP.RES.RECEIVE_TIME_END%%;

// System to client response timestamp variables

var ns_res_beg=%%HTTP.RES.SEND_TIME_BEG%%;

var ns_res_end=%%HTTP.RES.SEND_TIME_END%%;

</script>

More Information

Tags

appexpert appexpert Delete
code code Delete
prebody prebody Delete
postbody postbody Delete
injection injection Delete
pe pe Delete
html injection html injection Delete
policy filter policy filter Delete
filter policy filter policy Delete
policy engine policy engine Delete
how to how to Delete
Enter tags to add to this page:
Please wait 
Looking for a tag? Just start typing.
Related Links