Configuring Proxy for IIS 6

Topics: User Forum
Mar 2, 2010 at 9:09 PM

I'm trying to setup up a proxy with IIS 6 to route incoming browsers to the mail server. The orginal proxy works but after the first page it goes to heck. Given the following info does anyone have a clue as to what I'm doing wrong?

1 - I've added IIRF.dll as the ISAPI filter on the Web Site folder (global) as well as on the default web site.

2 - I've added IIRF.dll as an extension with the following command

IISEXT /addfile c:\windows\system32\inetsrv\iirf.dll 1 IIRF 0 IIRF.DLL

3 - I'm using the following iirf.ini

-----------------------------------------------------------------------------------------------------------

# Iirf.ini
#

RewriteLogLevel 5
RewriteLog C:\IirfLogs\iirf
RewriteEngine ON
StatusInquiry ON

ProxyPass ^(.*)$ Http://10.10.10.41$1
ProxyPass /names.nsf http://10.10.10.41/names.nsf
ProxyPass /domjava/ http://10.10.10.41/domjava/
ProxyPass /mail/ http://10.10.10.41/mail/
ProxyPass /iNotes/ http://10.10.10.41/iNotes/
ProxyPass /icons/ http://10.10.10.41/icons/
rewriterule /proxy.iirf?path=/LM/W3SVC/1/ROOT&url= ^$


#ProxyPass ^(.*)/66.170.136.6(.*)$ $1/10.10.10.41$2

#ProxyPass ^http://172.16.0.21$ http://10.10.10.41$1
#ProxyPass ^http://172.16.0.21/$ http://10.10.10.41/$1
#ProxyPass ^http://172.16.0.21/names.nsf(.*)$ http://10.10.10.41/names.nsf/$1
#ProxyPass ^http://172.16.0.21/domjava/(.*)$ http://10.10.10.41/domjava/$1
#ProxyPass ^http://172.16.0.21/mail/(.*)$ http://10.10.10.41/mail/$1
#ProxyPass ^http://172.16.0.21/iNotes/(.*)$ http://10.10.10.41/iNotes/$1
#ProxyPass ^http://172.16.0.21/icons/(.*)$ http://10.10.10.41/icons/$1


 ------------------------------------------------------------------------------------------------------------------------------------

 

This is this the response I get in my iirf.2876.log

----------------------------------------------------------------------------------------------------------

Tue Mar 02 16:04:17 -  3532 - CleanHeaders: done  'Date: Tue, 02 Mar 2010 21:04:18 GMT

Last-Modified: Tue, 02 Mar 2010 06:02:03 GMT

Content-Type: image/jpeg

Content-Length: 11755

ETag: W/"MTAtODA4Ny04NTI1NzZEQTAwMjEyNTgyLTg1MjU3NUI3MDAxQ0E3NzEtQTVGMjEzQjA5RTEzOEI3MjA1MjU2NkIyMDA2OEFBMzg="

 

'
Tue Mar 02 16:04:17 -  3532 - ProxyRequest: WinHttpReadData 4096
Tue Mar 02 16:04:17 -  3532 - ProxyRequest: WinHttpReadData nRead= 4096
Tue Mar 02 16:04:17 -  3532 - ProxyRequest: WinHttpReadData 4096
Tue Mar 02 16:04:17 -  3532 - ProxyRequest: WinHttpReadData nRead= 4096
Tue Mar 02 16:04:17 -  3532 - ProxyRequest: WinHttpReadData 3563
Tue Mar 02 16:04:17 -  3532 - ProxyRequest: WinHttpReadData nRead= 3563
Tue Mar 02 16:04:17 -  3532 - ProxyRequest: contentChunks(3) contentTotalBytes(11755)
Tue Mar 02 16:04:17 -  3532 - ReleaseArrayWchar: pw=    0x01278750
Tue Mar 02 16:04:17 -  3532 - ReleaseArrayWchar: pw[0]= 0x01278760
Tue Mar 02 16:04:17 -  3532 - DoRewrites: Proxy complete: 3 chunks, 11755 bytes'
Tue Mar 02 16:04:17 -  3532 - HttpFilterProc: SF_NOTIFY_LOG
Tue Mar 02 16:04:17 -  3532 - ReleaseOrExpireSiteConfig: site '/LM/W3SVC/1/ROOT' (era=0) (rc=8) (Expired=0) (ptr=0x01275420)...
Tue Mar 02 16:04:17 -  3532 - HttpFilterProc: SF_NOTIFY_LOG
Tue Mar 02 16:04:17 -  3532 - ReleaseOrExpireSiteConfig: site '/LM/W3SVC/1/ROOT' (era=0) (rc=7) (Expired=0) (ptr=0x01275420)...
Tue Mar 02 16:04:21 -  3532 - Cached: DLL_THREAD_DETACH
Tue Mar 02 16:04:21 -  3532 - Cached: DLL_THREAD_DETACH
Tue Mar 02 16:04:21 -  3532 - IsIniFileUpdated: c:\inetpub\wwwroot\Iirf.ini NO
Tue Mar 02 16:04:21 -  3532 - GetSiteConfig: Obtain  site '/LM/W3SVC/1/ROOT' (era=0) (rc=8) (Expired=0) (ptr=0x01275420)...
Tue Mar 02 16:04:21 -  3532 - HttpFilterProc: SF_NOTIFY_URL_MAP
Tue Mar 02 16:04:21 -  3532 - HttpFilterProc: cfg= 0x01275420
Tue Mar 02 16:04:21 -  3532 - IsIniFileUpdated: c:\inetpub\wwwroot\Iirf.ini NO
Tue Mar 02 16:04:21 -  3532 - GetSiteConfig: Obtain  site '/LM/W3SVC/1/ROOT' (era=0) (rc=9) (Expired=0) (ptr=0x01275420)...
Tue Mar 02 16:04:21 -  3532 - HttpFilterProc: SF_NOTIFY_URL_MAP
Tue Mar 02 16:04:21 -  3532 - HttpFilterProc: cfg= 0x01275420
Tue Mar 02 16:04:21 -  3532 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Tue Mar 02 16:04:21 -  3532 - DoRewrites
Tue Mar 02 16:04:21 -  3532 - GetServerVariable_AutoFree: getting 'url'
Tue Mar 02 16:04:21 -  3532 - GetServerVariable_AutoFree: 128 bytes
Tue Mar 02 16:04:21 -  3532 - GetServerVariable_AutoFree: result ''
Tue Mar 02 16:04:21 -  3532 - GetHeader_AutoFree: getting 'url'
Tue Mar 02 16:04:21 -  3532 - GetHeader_AutoFree: 17 bytes   ptr:0x000C99E0
Tue Mar 02 16:04:21 -  3532 - GetHeader_AutoFree: 'url' = '/names.nsf?Login'
Tue Mar 02 16:04:21 -  3532 - GetServerVariable_AutoFree: getting 'QUERY_STRING'
Tue Mar 02 16:04:21 -  3532 - GetServerVariable_AutoFree: 6 bytes
Tue Mar 02 16:04:21 -  3532 - GetServerVariable_AutoFree: result 'Login'
Tue Mar 02 16:04:21 -  3532 - GetHeader_AutoFree: getting 'method'
Tue Mar 02 16:04:21 -  3532 - GetHeader_AutoFree: 5 bytes   ptr:0x000C5118
Tue Mar 02 16:04:21 -  3532 - GetHeader_AutoFree: 'method' = 'POST'
Tue Mar 02 16:04:21 -  3532 - DoRewrites: New Url, before decoding: '/names.nsf?Login'
Tue Mar 02 16:04:21 -  3532 - DoRewrites: Url (no decoding): '/names.nsf?Login'
Tue Mar 02 16:04:21 -  3532 - EvaluateRules: depth=0
Tue Mar 02 16:04:21 -  3532 - EvaluateRules: Rule 1 : 2 matches
Tue Mar 02 16:04:21 -  3532 - ReplaceServerVariables: in='Http://10.10.10.41$1' out='Http://10.10.10.41$1'
Tue Mar 02 16:04:21 -  3532 - GenerateReplacementString: result 'Http://10.10.10.41/names.nsf?Login'
Tue Mar 02 16:04:21 -  3532 - EvaluateRules: Result (length 34): Http://10.10.10.41/names.nsf?Login
Tue Mar 02 16:04:21 -  3532 - EvaluateRules: returning 999
Tue Mar 02 16:04:21 -  3532 - DoRewrites: Proxy to: 'Http://10.10.10.41/names.nsf?Login'
Tue Mar 02 16:04:21 -  3532 - GetServerVariable_AutoFree: getting 'REQUEST_METHOD'
Tue Mar 02 16:04:21 -  3532 - GetServerVariable_AutoFree: 5 bytes
Tue Mar 02 16:04:21 -  3532 - GetServerVariable_AutoFree: result 'POST'
Tue Mar 02 16:04:21 -  3532 - ProxyRequest: Http://10.10.10.41/names.nsf?Login
Tue Mar 02 16:04:21 -  3532 - DoRewrites: requires rewrite to: '/proxy.iirf?path=/LM/W3SVC/1/ROOT&url=Http://10.10.10.41/names.nsf?Login'
Tue Mar 02 16:04:21 -  3532 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Tue Mar 02 16:04:21 -  3532 - DoRewrites
Tue Mar 02 16:04:21 -  3532 - GetServerVariable_AutoFree: getting 'url'
Tue Mar 02 16:04:21 -  3532 - GetServerVariable_AutoFree: 128 bytes
Tue Mar 02 16:04:21 -  3532 - GetServerVariable_AutoFree: result ''
Tue Mar 02 16:04:21 -  3532 - GetHeader_AutoFree: getting 'url'
Tue Mar 02 16:04:21 -  3532 - GetHeader_AutoFree: 73 bytes   ptr:0x000BF9F8
Tue Mar 02 16:04:21 -  3532 - GetHeader_AutoFree: 'url' = '/proxy.iirf?path=/LM/W3SVC/1/ROOT&url=Http://10.10.10.41/names.nsf?Login'
Tue Mar 02 16:04:21 -  3532 - GetServerVariable_AutoFree: getting 'QUERY_STRING'
Tue Mar 02 16:04:21 -  3532 - GetServerVariable_AutoFree: 61 bytes
Tue Mar 02 16:04:21 -  3532 - GetServerVariable_AutoFree: result 'path=/LM/W3SVC/1/ROOT&url=Http://10.10.10.41/names.nsf?Login'
Tue Mar 02 16:04:21 -  3532 - GetHeader_AutoFree: getting 'method'
Tue Mar 02 16:04:21 -  3532 - GetHeader_AutoFree: 5 bytes   ptr:0x000BE518
Tue Mar 02 16:04:21 -  3532 - GetHeader_AutoFree: 'method' = 'POST'
Tue Mar 02 16:04:21 -  3532 - DoRewrites: New Url, before decoding: '/proxy.iirf?path=/LM/W3SVC/1/ROOT&url=Http://10.10.10.41/names.nsf?Login'
Tue Mar 02 16:04:21 -  3532 - DoRewrites: Url (no decoding): '/proxy.iirf?path=/LM/W3SVC/1/ROOT&url=Http://10.10.10.41/names.nsf?Login'
Tue Mar 02 16:04:21 -  3532 - EvaluateRules: depth=0
Tue Mar 02 16:04:21 -  3532 - EvaluateRules: Rule 1 : 2 matches
Tue Mar 02 16:04:21 -  3532 - ReplaceServerVariables: in='Http://10.10.10.41$1' out='Http://10.10.10.41$1'
Tue Mar 02 16:04:21 -  3532 - GenerateReplacementString: result 'Http://10.10.10.41/proxy.iirf?path=/LM/W3SVC/1/ROOT&url=Http://10.10.10.41/names.nsf?Login'
Tue Mar 02 16:04:21 -  3532 - EvaluateRules: Result (length 90): Http://10.10.10.41/proxy.iirf?path=/LM/W3SVC/1/ROOT&url=Http://10.10.10.41/names.nsf?Login
Tue Mar 02 16:04:21 -  3532 - EvaluateRules: returning 999
Tue Mar 02 16:04:21 -  3532 - DoRewrites: Proxy to: 'Http://10.10.10.41/proxy.iirf?path=/LM/W3SVC/1/ROOT&url=Http://10.10.10.41/names.nsf?Login'
Tue Mar 02 16:04:21 -  3532 - GetServerVariable_AutoFree: getting 'REQUEST_METHOD'
Tue Mar 02 16:04:21 -  3532 - GetServerVariable_AutoFree: 5 bytes
Tue Mar 02 16:04:21 -  3532 - GetServerVariable_AutoFree: result 'POST'
Tue Mar 02 16:04:21 -  3532 - ProxyRequest: Http://10.10.10.41/proxy.iirf?path=/LM/W3SVC/1/ROOT&url=Http://10.10.10.41/names.nsf?Login
Tue Mar 02 16:04:21 -  3532 - DoRewrites: requires rewrite to: '/proxy.iirf?path=/LM/W3SVC/1/ROOT&url=Http://10.10.10.41/proxy.iirf?path=/LM/W3SVC/1/ROOT&url=Http://10.10.10.41/names.nsf?Login'
Tue Mar 02 16:04:21 -  3532 - HttpFilterProc: SF_NOTIFY_URL_MAP
Tue Mar 02 16:04:21 -  3532 - HttpFilterProc: cfg= 0x01275420
Tue Mar 02 16:04:21 -  3532 - HttpFilterProc: SF_NOTIFY_URL_MAP
Tue Mar 02 16:04:21 -  3532 - HttpFilterProc: cfg= 0x01275420
Tue Mar 02 16:04:21 -  3532 - HttpFilterProc: SF_NOTIFY_URL_MAP
Tue Mar 02 16:04:21 -  3532 - HttpFilterProc: cfg= 0x01275420
Tue Mar 02 16:04:21 -  3532 - HttpFilterProc: SF_NOTIFY_URL_MAP
Tue Mar 02 16:04:21 -  3532 - HttpFilterProc: cfg= 0x01275420
Tue Mar 02 16:04:21 -  3532 - HttpFilterProc: SF_NOTIFY_LOG
Tue Mar 02 16:04:21 -  3532 - ReleaseOrExpireSiteConfig: site '/LM/W3SVC/1/ROOT' (era=0) (rc=10) (Expired=0) (ptr=0x01275420)...
Tue Mar 02 16:04:21 -  3532 - HttpFilterProc: SF_NOTIFY_LOG
Tue Mar 02 16:04:21 -  3532 - ReleaseOrExpireSiteConfig: site '/LM/W3SVC/1/ROOT' (era=0) (rc=9) (Expired=0) (ptr=0x01275420)...

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Sorry for the length of the post but I'm not sure what's relevent and what's not.

Coordinator
Mar 3, 2010 at 3:51 AM

I can't tell what's going wrong.  From the log it looks like requests are being proxied.  I would guess, though, that requests are not being proxied with full fidelity.  Your rules truncate the requests.  Consider this one:

ProxyPass /domjava/ http://10.10.10.41/domjava/

The first problem with that is that you are not matching on the beginning of the URL.  To do that you need to start the pattern with a circumflex.  Without that, the pattern will match any URL that happens to have a /domjava/ somewhere in the URL, even in the query string.  Probably not what you want. 

The second problem is that anything that follows /domjava/ in the incoming URL is not applied to the URL you are proxying to.  if the incoming url is /domjava/mailbox/joe, the request that you send out is http://10.10.10.42/domjava .  Notice that any URL path beyond /domjava gets trimmed.

To fix those things, I suggest something more like this:

ProxyPass ^/domjava/(.*)$  http://10.10.10.41/domjava/$1

And of course you'd need to make those changes for all the other similar rules.

I don't understand why you have a RewriteRule on proxy.iirf.  That seems wrong.  But maybe you figure you need it for some reason.

Those changes should make things a little better.

 

Mar 3, 2010 at 2:38 PM

Thanks Cheeso. Is there any documentation on how to read the IIRF Log? 'Cause it's mostly goobledygook tome. Here's why I ask.  After I made the changes you suggested, including remmed out the RewiteRule, I stopped and restarted the web server and got the same results.  I then went to my extensions page and Allowed - All Unknown ISAPI Extensions. Now I'm getting

"the website cannot display the page" error (before it  was a 404 page cannot be found)

Even if I prohibit the IIRF extension. Any thoughts?

Coordinator
Mar 4, 2010 at 4:36 AM

There's no doc on how to interpret the IIRF log.

I don't know what request you're sending to get "the website cannot display the web page."   I suggest you use a debugging HTTP proxy like Fiddler to examine the HTTP transactions, to see if they are what you think they should be.

If you're having basic, "is this thing on?" problems, then consult the "troubleshooting" section in the documentation, to verify the install.

good luck.

 

Coordinator
Mar 24, 2010 at 6:08 PM

Just an update -

  1. I've made some fixes to the ProxyPass feature of IIRF. These are available in the latest update of IIRF v2.1 beta, v2.1.0.15, available at http://iirf.codeplex.com/releases/view/36814. I'd encourage everyone using ProxyPass to get that update. It corrects a problem with passing http headers across the proxy boundary, and also with proxied payloads larger than 48k.

    Be careful about the version numbers. The current "stable" release is v2.0.1.15, the latest beta is v2.1.0.15. The release I refer to here, with the fixes for ProxyPass, is v2.1.0.15 (latest beta).

  2. To check if you have correctly configured IIRF as an ISAPI extension, you can use your browser to visit a URL like: http://yourserver/INSERT ANYTHING HERE.iirf . This will cause a diagnostic page to be returned. It looks like this:

    If you don't get that page, then you haven't configured IIRF properly.