This forum has been moved here:
Helicon Tech Community Forum

ISAPI_Rewrite 3.0 (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: Proxy forward fails with Host parameter
Author
Message |
michaelk2
Newbie


Joined: 02 March 2012
Posts: 2
Posted: 02 March 2012 at 7:08am

I'm using ISAPI rewrite version 3.1.0.88 and am having problems with a proxy forward under some circumstances:

The rule looks like this:

Code:

RewriteCond %{HTTP:Host} ^www\.myhostname\.com$
RewriteRule ^/externalpath$ http://myinternalhost:12345/internalpath/servlet.do [P,L]


This forward works fine if you access it via browser (e.g. Firefox), but it doesn't work if the HTTP request contains a "Host" with a port (the port is according to the HTTP 1.1 spec allowed but optional).

So this request works fine (request reaches myinternalhost as expected) :

Code:

GET /externalpath?requestType=foo HTTP/1.1
Host: www.myhostname.com


But this request fails (IIS reports a 404)

Code:

GET /externalpath?requestType=foo HTTP/1.1
Host: www.myhostname.com:80


These requests were tested via telnet (telnet www.myhostname.com 80) to eliminate any client issues.
The redirect.log and error.log files contain no or no useful information respectivly (error log only contains lines about successful server startups)

Back story: I need to access this redirect through the latest Apache httpClient library. (http://hc.apache.org/httpcomponents-client-ga/). This library adds the Host parameter with port which is not configurable.
Back to Top
 
michaelk2
Newbie


Joined: 02 March 2012
Posts: 2
Posted: 02 March 2012 at 7:51am

After figuring out how to turn on the logs and sifting through 20mb of log files I managed to solve it myself:
The condition was incorrect and failed if the port was sent by the client. The correct condition which works is:

RewriteCond %{HTTP:Host} ^www\.myhostname\.com:?\d*$
Back to Top
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version