views:

225

answers:

2

Hello all,

I have installed the full verison of isapi_rewrite and have setup a proxy directive so that all traffic to my workstation in the folder 'ngis' (on any port) goes to another server. This is for testing purposes to check suitability before rolling out isapi_redirect to our prod servers.

I have a rule as follows:

RewriteRule ^ngis/(.+)$ http://10.2.25.157:8080/ngis/$1 [NC, P]

This works perfectly when I enter a URL as follows:

http://10.1.111.20:8080/ngis/QueryEngine.ptl/DocTree(%60/2007/MELBOURNE/R01%60,%601%60).xml

However, if I enter a UIRL with a querystring, such as:

http://10.1.111.20:8080/ngis/QueryEngine.ptl/DocTree(%60/2007/MELBOURNE/R01%60,%601%60).xml?VIEW=RAW

I get a "The page cannot be found" error.

Looking in the logs the steps appear to be the same. Here is the log entry for the two requests above:

[10.1.111.20/sid#1][rid#11050940/initial] (2) init rewrite engine with requested uri /ngis/QueryEngine.ptl/DocTree(`/2007/MELBOURNE/R01`,`1`).xml
[10.1.111.20/sid#1][rid#11050940/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
[10.1.111.20/sid#1][rid#11050940/initial] (1) Htaccess process request c:\inetpub\wwwroot\.htaccess
[10.1.111.20/sid#1][rid#11050940/initial] (3) applying pattern '^ngis/(.+)$' to uri 'ngis/QueryEngine.ptl/DocTree(`/2007/MELBOURNE/R01`,`1`).xml'
[10.1.111.20/sid#1][rid#11050940/initial] (2) forcing proxy-throughput with http://10.2.25.157:8080/ngis/QueryEngine.ptl/DocTree(`/2007/MELBOURNE/R01`,`1`).xml
[10.1.111.20/sid#1][rid#11050940/initial] (1) go-ahead with proxy request http://10.2.25.157:8080/ngis/QueryEngine.ptl/DocTree(`/2007/MELBOURNE/R01`,`1`).xml [OK]
[10.1.111.20/sid#1][rid#11050940/initial] (1) Rewrite URL to >> http://10.2.25.157:8080/ngis/QueryEngine.ptl/DocTree(`/2007/MELBOURNE/R01`,`1`).xmlx.rwhlp?p=2
[10.1.111.20/sid#1][rid#11050940/initial] (2) rewrite 'ngis/QueryEngine.ptl/DocTree(`/2007/MELBOURNE/R01`,`1`).xml' -> 'http://10.2.25.157:8080/ngis/QueryEngine.ptl/DocTree(`/2007/MELBOURNE/R01`,`1`).xmlx.rwhlp?p=2'
[10.1.111.20/sid#1][rid#11050940/initial] (2) internal redirect with http://10.2.25.157:8080/ngis/QueryEngine.ptl/DocTree(`/2007/MELBOURNE/R01`,`1`).xmlx.rwhlp?p=2 [INTERNAL REDIRECT]

[10.1.111.20/sid#1][rid#11050940/initial] (2) init rewrite engine with requested uri /ngis/QueryEngine.ptl/DocTree(`/2007/MELBOURNE/R01`,`1`).xml?VIEW=RAW
[10.1.111.20/sid#1][rid#11050940/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
[10.1.111.20/sid#1][rid#11050940/initial] (1) Htaccess process request c:\inetpub\wwwroot\.htaccess
[10.1.111.20/sid#1][rid#11050940/initial] (3) applying pattern '^ngis/(.+)$' to uri 'ngis/QueryEngine.ptl/DocTree(`/2007/MELBOURNE/R01`,`1`).xml'
[10.1.111.20/sid#1][rid#11050940/initial] (2) forcing proxy-throughput with http://10.2.25.157:8080/ngis/QueryEngine.ptl/DocTree(`/2007/MELBOURNE/R01`,`1`).xml?VIEW=RAW
[10.1.111.20/sid#1][rid#11050940/initial] (1) go-ahead with proxy request http://10.2.25.157:8080/ngis/QueryEngine.ptl/DocTree(`/2007/MELBOURNE/R01`,`1`).xml?VIEW=RAW [OK]
[10.1.111.20/sid#1][rid#11050940/initial] (1) Rewrite URL to >> http://10.2.25.157:8080/ngis/QueryEngine.ptl/DocTree(`/2007/MELBOURNE/R01`,`1`).xml?VIEW=RAWx.rwhlp?p=2
[10.1.111.20/sid#1][rid#11050940/initial] (2) rewrite 'ngis/QueryEngine.ptl/DocTree(`/2007/MELBOURNE/R01`,`1`).xml' -> 'http://10.2.25.157:8080/ngis/QueryEngine.ptl/DocTree(`/2007/MELBOURNE/R01`,`1`).xml?VIEW=RAWx.rwhlp?p=2'
[10.1.111.20/sid#1][rid#11050940/initial] (2) internal redirect with http://10.2.25.157:8080/ngis/QueryEngine.ptl/DocTree(`/2007/MELBOURNE/R01`,`1`).xml?VIEW=RAWx.rwhlp?p=2 [INTERNAL REDIRECT]

As you can see, as far as isapi_rewrite is concerned it has done its bit. However, I can confirm that the target server does not receive the request (as we are debugging it at the time to try and diagnose the issue!)

The issue appears to be cauised by the existence of a '?' and some querystring parameters.

I have tried both RewriteRule and RewriteProxy and get the same issue.

Any ideas? Cheers.

A: 

In apache we use the [QSA] flag to add the original querystring, not sure about isapi_rewrite. Where does this illusive x.rwhlp?p=2 appending come from?

Wrikken
A: 

I have tried the [QSA] flag, but the page still appears to be throwing up the 404 without even making the request to the remote server.

The x.rwhlp?p=2 is appended by the component (as far as I can tell) as the installation for isapi_rewrite 3 has created a handler for the .rwhlp extension - this appears to be the way that it works. However, the request made to the target server does not include this additional part to the URL.

MarkEverest