Showing results for 
Search instead for 
Did you mean: 

HowTo: Rewriting HTTP responses

Suppose that you wanted to publish an internal website ( so that it can be accessed externally (with the correct access controls and security of course!). However, the domain name is not valid externally, and you want to refer to the site via the URL


One key requirement is to rewrite any HTML that includes references to, so that they refer to The following response rule will do this:


$url = http.getResponseHeader( "Content-Type" );  
if( !string.startsWith( $url, "text/html" ) ) break;  
$response = http.getResponseBody();  
$response = string.replaceAll( $response,   
  "", "" );  
http.setResponseBody( $response );


http.getResponseBody() and http.setResponseBody() are all that are required to get and set HTTP responses.  These functions take care of the various encodings (e.g. chunk transfer), compression (e.g. gzip) and protocol considerations (e.g. HTTP version, content-length) to ensure that you can reliably manage HTTP responses.


Read more


Version history
Revision #:
1 of 1
Last update:
‎02-25-2013 12:47:AM
Updated by:
Labels (1)