Rewriting responses with "Generic Client First" and "Generic Server First" protocols

TrafficScript HTTP functions are not available when using the "Generic Client First" and "Generic Server First" protocols. However, you may want to use TrafficScript rules to rewrite response headers, such as "Location" redirects.

The TrafficScript rule below rewrites the "Location" header to prevent the client from being redirected to an unsecure URL.

This rule shows how we can use non HTTP functions within TrafficScript to achieve the same type of functionaility that would be available when using the HTTP protocol.

# read until we are sure we have all the headers in the buffer
$r = response.getLine( "\r?\n\r?\n" );

# now read the entire response buffer
$r = response.get();

# regular expression rewrites the Location header
$s = string.regexsub( $r, "Location: http://www.example.com", "Location: https://www.example.com" );

# set the new response
response.set( $s );

Remember to set this as a response rule and associate it with the appropriate Virtual Server.

Graham Moore [Zeus Systems Engineering] 05 June 2006  Permalink 2 comments  

Comments:

This public messageboard is not a forum for technical support. To report technical support problems, please contact our dedicated Support team using the instructions at the bottom of this page.

Comment from: Julian Gericke [Visitor]
Hi,

Is it possible to redirect standard TCP based protocols that don't offer "Location" type headers in their responses, such as telnet or RPC?

I've tried creating a rule that rewrites the entire response, substituting hostnames with the string.regexsub as in the above example. The connection does initiate but times out after about 5 seconds or so.
Permalink 29 November 2007 @ 16:17
Comment from: Owen Garrett [Zeus Dev Team]
Hi Julian,

If a protocol does not have a way to tell the client to reconnect to a different server, then you should look at ZXTM's Forward Proxy capability; ZXTM can forward the TCP connection to any server, whether it's named in the pool or not.

If you're having trouble getting a rule to run, drop a line to our tech support team.
Permalink 30 November 2007 @ 10:31
Leave a comment ...
Your email address will not be displayed.
Your URL will be displayed.
This public messageboard is not a forum for technical support. To report technical support problems, please contact our dedicated Support team using the instructions at the bottom of this page.
Options:
 
(Line breaks become <br />)
(Set cookies for name, email & url)
Download Free ZXTM Desktop Edition

Recent Articles

Other Resources



www.zeus.com