cancel
Showing results for 
Search instead for 
Did you mean: 

Redirecting based on URL: Rule selected an unresolvable host warning messages.

SOLVED
rww725
New Contributor

Redirecting based on URL: Rule selected an unresolvable host warning messages.

Our goal is to redirect based on the URL.  So basically, https://test.com/test1 would go to the server test1, while https://test.com/test2 would go to the server test2.

We are getting Rule selected an unresolvable host warning messages in line 19. We are also seeing issues downloading all the resources from a page.   When we look at the http traffic using web debuggers, we are seeing long delays and blocking periods for elements like images to download.   Some are taking 30-60 seconds.  When we test directly from the webserver (http://localhost/test1) we cannot reproduce the problem.  

Here is a copy of the rule we have:


$host = http.getHeader( "Host");


if (http.headerExists( "X-Forwarded-For") || $host == "" ) {


   http.sendResponse( "400 Bad request", "text/plain", "This is a proxy service, you must send proxy requests", "");


}



$pos = string.find( $host, ":");


if($pos >= 0) {


   $port = string.skip( $host,$pos + 1);


   $host = string.substring( $host,0,$pos - 1);


} else {


   $port = 80;


}


http.setHeader( "X-Forwarded-For", request.getRemoteIP() );


http.removeHeader( "Range" );


http.removeHeader( "Proxy-Connection" );



$rawurl = http.getRawURL();


if( string.contains( $rawurl, "/ema" ) ) {


   pool.use( "test1", $rawurl , $port );


}





1 ACCEPTED SOLUTION

Accepted Solutions
vreddy
New Contributor

Re: Redirecting based on URL: Rule selected an unresolvable host warning messages.

Hello RWW725,

If I understand correctly your requirement is that you want to select a specific node in a pool for a given URL match. If I assume test1 and test2 are the nodes in the pool named "testpool" then you need to change the arguments  to the function pool.use as

          pool.use ("testpool","test1",$port);

Since you have provided $rawurl as the argument as node name, this might be the reason why you might be seeing a warning message.

-vinay

View solution in original post

2 REPLIES 2
vreddy
New Contributor

Re: Redirecting based on URL: Rule selected an unresolvable host warning messages.

Hello RWW725,

If I understand correctly your requirement is that you want to select a specific node in a pool for a given URL match. If I assume test1 and test2 are the nodes in the pool named "testpool" then you need to change the arguments  to the function pool.use as

          pool.use ("testpool","test1",$port);

Since you have provided $rawurl as the argument as node name, this might be the reason why you might be seeing a warning message.

-vinay

rww725
New Contributor

Re: Redirecting based on URL: Rule selected an unresolvable host warning messages.

This worked and the page loads instantly.  Thanks so much!