cancel
Showing results for 
Search instead for 
Did you mean: 

Setting up a proxy for ZXTM

Highlighted
Occasional Contributor

Setting up a proxy for ZXTM

I'am setting up a ZXTM reverse proxy (code below) in order to access an external site.

$path = http.getPath(); 

        $contents = resource.get("proxy.properties");

$proxyList = string.split( $contents, "\n" );

foreach( $prop in $proxyList ) {

   if( string.regexMatch( $prop, "(.+)=(.+)Smiley Sad[0-9]+)" )) {        

      $configuredPath = string.trim($1);

      

      if( string.startsWithI($path, $configuredPath)) {   

         $host = string.unescape(string.trim($2));          

         http.setHeader( "Host", $host);

        

         $port = string.unescape(string.trim($3));

         pool.use("PROXY", $host, $port);

      }

   }

}     

Here the PROXY pool is a 'dummy' one and I have a proxy.properties file whose entries are of the format

pathPattern=externalUrl

This rule is working fine, however I cannot use this rule because the ZXTM box doesn't have connectivity to this external/public site. Therefore its suggested to use a proxy server ( i.e. proxy.company.com) for accessing this external site ( along with this rule.)

My question is - is it possible to let ZXTM access a particular URL via a proxy server (To make connection to externalUrl  via proxy.company.com - like we enable proxy settings for browsers)? Else is there any workaround?

2 REPLIES
Contributor

Re: Setting up a proxy for ZXTM

You want to use another reverse proxy server. It will connect to your actual origin, and you will use it as your ZXTM pool.

Contributor

Re: Setting up a proxy for ZXTM

Hi Fahim,

If you are pushing everything through a proxy, then you can remove the forward proxy "pool.use(pool, host, port) and replace with pool.use(proxypool). Then specify the proxy(ies) in the pool itself.

You will also need to convert the standard HTTP requests into proxy ones. For example if your request is for "/bar.jsp" and you want to use the external host "http://www.foo.com:8080/bar.jsp" then you should set that in the path with http.setPath(). You might also want to set a proxy-connection header. EG http.setHeader("Proxy-Connection", "Keep-Alive"). The proxy will then do the rest.

Cheers,

Mark