RewriteProxy with Port

ISAPI_Rewrite is a powerful URL manipulation engine based on regular expressions
User avatar
Posts: 7
Joined: 23 Aug 2012, 21:09

RewriteProxy with Port

17 Jun 2014, 13:07

We are currently using Isapi_Rewrite 2.15..

I am trying to use RewriteProxy to proxy to another server with a specific port number, for some reason this is not working. I am able to use the same redirect using RewriteRule, but RewriteProxy gives me a 500 error.

Example:

RewriteProxy /test/here/([a-z0-9]+) http\://123.456.7.8\:123456/?RequestType=TryThis&ID=$1 [U,I,D]

it also doesn't work if i don't escape the colons.
also, i tested RewriteProxy without a port number, and it does work.

Thanks for your help.

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: RewriteProxy with Port

18 Jun 2014, 05:47

Hello,

Please make sure you are using the latest build and if not, please upgrade to the latest version.
Also please specify the Windows version you are using. You may want to consider shifting to ISAPI_Rewrite 3, which is more advanced and is still supported (we are not making fixes to v2 for quite a while as it is an obsolete version).

User avatar
Posts: 7
Joined: 23 Aug 2012, 21:09

Re: RewriteProxy with Port

18 Jun 2014, 10:29

Thanks for responding.
I downloaded the ISAPI_Rewrite3_0104 32 bit version to our Windows 2000 machine.
I placed these rules in the httpd.conf and I still have the same problem.

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: RewriteProxy with Port

18 Jun 2014, 11:27

Hello,

Please try to fix the rule a bit to correspond to v3 syntax:

RewriteBase
RewriteProxy ^/test/here/([a-z0-9]+) http://123.456.7.8:123456/?RequestType=TryThis&ID=$1 [NC]

If you need any additional flags, please check here: http://www.helicontech.com/isapi_rewrit ... eProxy.htm

User avatar
Posts: 7
Joined: 23 Aug 2012, 21:09

Re: RewriteProxy with Port

23 Jun 2014, 15:16

I changed to the NC flag (and added RewriteBase) and I still get the 500 error.

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: RewriteProxy with Port

24 Jun 2014, 07:33

Hello,

Let me clarify several points:
- does the RewriteProxy rule work fine when without port?
- Can you access the destination URL directly from the browser?
- please enable logging in httpd.conf by putting

RewriteLogLevel 9

and provide rewrite.log records for your test request.

User avatar
Posts: 7
Joined: 23 Aug 2012, 21:09

Re: RewriteProxy with Port

24 Jun 2014, 09:24

The destination url does work when I go directly to it in my browser.
I turned on logging: First one is with the port, and second is without (which works successfully).

127.0.0.1 127.0.0.1 Tue, 24-Jun-2014 08:15:29 GMT [localhost/sid#1][rid#20258456/initial] (2) init rewrite engine with requested uri /thisOne/doSomething/id246
127.0.0.1 127.0.0.1 Tue, 24-Jun-2014 08:15:29 GMT [localhost/sid#1][rid#20258456/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
127.0.0.1 127.0.0.1 Tue, 24-Jun-2014 08:15:29 GMT [localhost/sid#1][rid#20258456/initial] (3) applying pattern '/httpd(?:\.ini|\.parse\.errors).*' to uri '/thisOne/doSomething/id246'
127.0.0.1 127.0.0.1 Tue, 24-Jun-2014 08:15:29 GMT [localhost/sid#1][rid#20258456/initial] (3) applying pattern '.*\.isrwhlp' to uri '/thisOne/doSomething/id246'
127.0.0.1 127.0.0.1 Tue, 24-Jun-2014 08:15:29 GMT [localhost/sid#1][rid#20258456/initial] (3) applying pattern '/thisOne/doSomething/([a-z0-9]+)' to uri '/thisOne/doSomething/id246'
127.0.0.1 127.0.0.1 Tue, 24-Jun-2014 08:15:29 GMT [localhost/sid#1][rid#20258456/initial] (2) forcing proxy-throughput with http://192.168.1.5:123/?RequestType=DoS ... derID=1234
127.0.0.1 127.0.0.1 Tue, 24-Jun-2014 08:15:29 GMT [localhost/sid#1][rid#20258456/initial] (1) go-ahead with proxy request http://192.168.1.5:123/?RequestType=DoS ... derID=1234 [OK]
127.0.0.1 127.0.0.1 Tue, 24-Jun-2014 08:15:29 GMT [localhost/sid#1][rid#20258456/initial] (1) Rewrite URL to >> /thisOne/doSomething/id246x.rwhlp?p=0
127.0.0.1 127.0.0.1 Tue, 24-Jun-2014 08:15:29 GMT [localhost/sid#1][rid#20258456/initial] (2) rewrite '/thisOne/doSomething/id246' -> '/thisOne/doSomething/id246x.rwhlp?p=0'
127.0.0.1 127.0.0.1 Tue, 24-Jun-2014 08:15:29 GMT [localhost/sid#1][rid#20258456/initial] (2) internal redirect with /thisOne/doSomething/id246x.rwhlp?p=0 [INTERNAL REDIRECT]

127.0.0.1 127.0.0.1 Tue, 24-Jun-2014 08:18:11 GMT [localhost/sid#1][rid#20258456/initial] (2) init rewrite engine with requested uri /test/hello
127.0.0.1 127.0.0.1 Tue, 24-Jun-2014 08:18:11 GMT [localhost/sid#1][rid#20258456/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
127.0.0.1 127.0.0.1 Tue, 24-Jun-2014 08:18:11 GMT [localhost/sid#1][rid#20258456/initial] (3) applying pattern '/httpd(?:\.ini|\.parse\.errors).*' to uri '/test/hello'
127.0.0.1 127.0.0.1 Tue, 24-Jun-2014 08:18:11 GMT [localhost/sid#1][rid#20258456/initial] (3) applying pattern '.*\.isrwhlp' to uri '/test/hello'
127.0.0.1 127.0.0.1 Tue, 24-Jun-2014 08:18:11 GMT [localhost/sid#1][rid#20258456/initial] (3) applying pattern '/thisOne/doSomething/([a-z0-9]+)' to uri '/test/hello'
127.0.0.1 127.0.0.1 Tue, 24-Jun-2014 08:18:11 GMT [localhost/sid#1][rid#20258456/initial] (3) applying pattern '/test/hello' to uri '/test/hello'
127.0.0.1 127.0.0.1 Tue, 24-Jun-2014 08:18:11 GMT [localhost/sid#1][rid#20258456/initial] (2) forcing proxy-throughput with http://www.adorama.com/wertyu.html
127.0.0.1 127.0.0.1 Tue, 24-Jun-2014 08:18:11 GMT [localhost/sid#1][rid#20258456/initial] (1) go-ahead with proxy request http://www.adorama.com/wertyu.html [OK]
127.0.0.1 127.0.0.1 Tue, 24-Jun-2014 08:18:11 GMT [localhost/sid#1][rid#20258456/initial] (1) Rewrite URL to >> /test/hellox.rwhlp?p=0
127.0.0.1 127.0.0.1 Tue, 24-Jun-2014 08:18:11 GMT [localhost/sid#1][rid#20258456/initial] (2) rewrite '/test/hello' -> '/test/hellox.rwhlp?p=0'
127.0.0.1 127.0.0.1 Tue, 24-Jun-2014 08:18:11 GMT [localhost/sid#1][rid#20258456/initial] (2) internal redirect with /test/hellox.rwhlp?p=0 [INTERNAL REDIRECT]

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: RewriteProxy with Port

24 Jun 2014, 10:01

Hello,

Please try to do the following:
- put

<Helicon>
ProxySuppressErrors Off
</Helicon>

in httpd.conf to enable more verbose error messages. And show what your 500 error will tell.

- try to request the URL with the port from your SERVER, not from your local machine.

- try to use the port number bigger than 1024.

User avatar
Posts: 7
Joined: 23 Aug 2012, 21:09

Re: RewriteProxy with Port

24 Jun 2014, 12:36

this is the error i see in the browser:

Error in ISAPI_Rewrite helper ISAPI extension.
12152 - The server returned an invalid or unrecognized response
File: AsyncProxy.cpp, Line: 219.
Internal Error

I am requesting the url from my server
the port I am trying is 60001

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: RewriteProxy with Port

26 Jun 2014, 04:56

Hello,

Well it didn't help much.
Please install wFetch on your server and make your direct request (without proxy) via wFetch.
And send us the response from the server.
We'll investigate what proxy can consider invalid or unrecognized.

Return to ISAPI_Rewrite 2.x

Who is online

Users browsing this forum: No registered users and 8 guests