Showing results for 
Search instead for 
Did you mean: 

Using current version version (v18.3) of virtual traffic manager as a forward proxy for HTTPS

Regular Visitor

Using current version version (v18.3) of virtual traffic manager as a forward proxy for HTTPS

We have been struggling to try and configure a traffic script so our virtual traffic manager (v18.3) can act as a forward proxy of HTTPS traffic. We found the post for HTTP traffic which seems to work ok. We also found a very old post that had an example TrafficScript to handle HTTPS traffic. The traffic manager balks at trying to apply the HTTP rule as given stating protocol specific rules ust be used instead of generic ones. So we have been trying to conver the old script and having no luck. The script is from That script is shown below. Has anyone been able to get their virtual TM to act as a forward proxy for HTTPS traffic and can maybe suggest tips to get it working?

# The CONNECT request ends with an empty line; the \r is optional:
$request = request.getLine("\r?\n\r?\n");

# Check for SSL connect requests. If it's not a CONNECT then break
if( ! string.regexMatch($request,"CONNECT (.+?)Smiley Sad[0-9]+?) HTTP.*") )

# This is an SSL request
$host = $1; 
$port = $2;

# Resolve the hostname to an IP address
$ip = net.dns.resolveHost( $host );
if ( $ip == "" ) {"Unknown host: '" . $host . "'");
  request.sendResponse("HTTP/1.1 404 Unknown Host\r\n\r\n");

# Select the destination node, and tell the client we're connected."Forward Proxy", $ip, $port);

# Everything after the first empty line must go to the remote 
# destination ('back-end'), but everything up to the first line
# is only used by the proxy (ZXTM).
$to_skip = string.len($request);

# Read in the rest of the request (if any). Do not append,
# however, as request.get() gives the full string again
$request = request.get();

if( string.len($request) == $to_skip ) {
  request.sendResponse("HTTP/1.1 200 Connection Established\r\n".
  "Proxy-Agent: ZXTM/Request\r\n\r\n");
  } else {
  # tell the response rule that it must send the
  # 'Connection established' status line"must_send_200", 1);