IIS6 Rewrite Not working

Topics: Developer Forum, User Forum
Dec 15, 2011 at 6:37 AM

Hi,

I have installed the latest IIRF on windows 2003 with IIS6. The purpose of using IIRF is to rewrite the incoming request, http://iis:8080/abc to http://anothermachine:9090/xyz using ISAPI redirector.So basically I want to change the context from abc to xyz. Is the approach correct?

Assuming is correct, After configuration had been done, I did some verification test.

Without the IIRF.ini in a virtual directory, the browser shows a reporting webpage, indicating IIRF is missing. However after adding the IIRF.ini in the virtual dir, the browser return 404 page. Below is the example of the content of the IIRF.ini

RewriteRule    /abc/    /xyz

RewriteLog c:\logs\iirf

RewriteLogLevel 5


Next I tried the rewrite function and it does not seems to work. I understand the IIS uses an ASP.Net4
and I have added the entry (EnableExtensionlessUrls to 0) in the registry.

The following is the log
hu Dec 15 19:04:31 -  2128 - Cached: DLL_THREAD_DETACH
Thu Dec 15 19:04:31 -  2128 - Cached: DLL_THREAD_DETACH
Thu Dec 15 19:04:31 -  2128 - Cached: DLL_THREAD_DETACH
Thu Dec 15 19:04:31 -  2128 - ReadVdirConfig: actual log file 'c:\logs\iirf.2568.log'
Thu Dec 15 19:04:31 -  2128 - ReadVdirConfig: ini file: 'C:\Jakarta_Isapi_Redirector\PUBLIC2\abc\Iirf.ini'
Thu Dec 15 19:04:31 -  2128 - ReadVdirConfig: ini file timestamp: 2011/12/15 18:36:37 New Zealand Daylight Time
Thu Dec 15 19:04:31 -  2128 - ReadVdirConfig: cfg(0x01C74E18)
Thu Dec 15 19:04:31 -  2128 - ReadVdirConfig: LogLevel = 5
Thu Dec 15 19:04:31 -  2128 - ReadVdirConfig: pass 2
Thu Dec 15 19:04:31 -  2128 - ReadVdirConfig: C:\Jakarta_Isapi_Redirector\PUBLIC2\abc\Iirf.ini(1): RewriteRule (rule 1)  '/abc/'  '/xyz'   (null)
Thu Dec 15 19:04:31 -  2128 - CountIniLines: ini file C:\Jakarta_Isapi_Redirector\PUBLIC2\abc\Iirf.ini (6 lines)
Thu Dec 15 19:04:31 -  2128 - ReadVdirConfig: Done reading INI for vdir(/abc), found 1 rules (0 errors, 0 warnings) on 6 lines, in 1 modules
Thu Dec 15 19:04:31 -  2128 - GetVdirConfig: Obtain  vdir '/LM/W3SVC/32276582/Root/abc' (era=0) (rc=1) (Expired=0) (ptr=0x01C74E18)...
Thu Dec 15 19:04:31 -  2128 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Dec 15 19:04:31 -  2128 - HttpFilterProc: cfg= 0x01C74E18
Thu Dec 15 19:04:31 -  2128 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Thu Dec 15 19:04:31 -  2128 - DoRewrites
Thu Dec 15 19:04:31 -  2128 - GetHeader_AutoFree: getting 'url'
Thu Dec 15 19:04:31 -  2128 - GetHeader_AutoFree: 10 bytes   ptr:0x000D4AA0
Thu Dec 15 19:04:31 -  2128 - GetHeader_AutoFree: 'url' = '/abc/'
Thu Dec 15 19:04:31 -  2128 - GetServerVariable_AutoFree: getting 'QUERY_STRING'
Thu Dec 15 19:04:31 -  2128 - GetServerVariable_AutoFree: 1 bytes
Thu Dec 15 19:04:31 -  2128 - GetServerVariable_AutoFree: result ''
Thu Dec 15 19:04:31 -  2128 - GetHeader_AutoFree: getting 'method'
Thu Dec 15 19:04:31 -  2128 - GetHeader_AutoFree: 4 bytes   ptr:0x000D4A18
Thu Dec 15 19:04:31 -  2128 - GetHeader_AutoFree: 'method' = 'GET'
Thu Dec 15 19:04:31 -  2128 - DoRewrites: New Url, before decoding: '/abc/'
Thu Dec 15 19:04:31 -  2128 - DoRewrites: Url (decoded): '/abc/'
Thu Dec 15 19:04:31 -  2128 - EvaluateRules: depth=0
Thu Dec 15 19:04:31 -  2128 - GetServerVariable: getting 'SCRIPT_NAME'
Thu Dec 15 19:04:31 -  2128 - GetServerVariable: 10 bytes
Thu Dec 15 19:04:31 -  2128 - GetServerVariable: result '/abc/'
Thu Dec 15 19:04:31 -  2128 - EvaluateRules: no RewriteBase
Thu Dec 15 19:04:31 -  2128 - EvaluateRules: Rule 1: pattern: /abc/  subject: /abc/
Thu Dec 15 19:04:31 -  2128 - EvaluateRules: Rule 1: 1 match
Thu Dec 15 19:04:31 -  2128 - ReplaceServerVariables: alloc 7 bytes
Thu Dec 15 19:04:31 -  2128 - ReplaceServerVariables: in='/xyz' out='/xyz'
Thu Dec 15 19:04:31 -  2128 - GenerateReplacementString: alloc 8 bytes
Thu Dec 15 19:04:31 -  2128 - ApplyUrlEncoding: in '/xyz'
Thu Dec 15 19:04:31 -  2128 - ApplyUrlEncoding: out '/xyz'
Thu Dec 15 19:04:31 -  2128 - GenerateReplacementString: result '/xyz'
Thu Dec 15 19:04:31 -  2128 - EvaluateRules: Result (length 6): /xyz
Thu Dec 15 19:04:31 -  2128 - EvaluateRules: depth=1
Thu Dec 15 19:04:31 -  2128 - GetServerVariable: getting 'SCRIPT_NAME'
Thu Dec 15 19:04:31 -  2128 - GetServerVariable: 10 bytes
Thu Dec 15 19:04:31 -  2128 - GetServerVariable: result '/abc/'
Thu Dec 15 19:04:31 -  2128 - EvaluateRules: no RewriteBase
Thu Dec 15 19:04:31 -  2128 - EvaluateRules: Rule 1: pattern: /abc/  subject: /xyz
Thu Dec 15 19:04:31 -  2128 - EvaluateRules: Rule 1: -1 (No match)
Thu Dec 15 19:04:31 -  2128 - EvaluateRules: returning 0
Thu Dec 15 19:04:31 -  2128 - EvaluateRules: returning 1
Thu Dec 15 19:04:31 -  2128 - DoRewrites: Rewrite Url to: '/xyz'
Thu Dec 15 19:04:31 -  2128 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Dec 15 19:04:31 -  2128 - HttpFilterProc: cfg= 0x01C74E18
Thu Dec 15 19:04:31 -  2128 - HttpFilterProc: SF_NOTIFY_LOG
Thu Dec 15 19:04:31 -  2128 - ReleaseOrExpireVdirConfig: vdir '/LM/W3SVC/32276582/Root/abc' (era=0) (rc=0) (Expired=0) (ptr=0x01C74E18)...



Thanks
Andrew

 

 

Coordinator
Dec 18, 2011 at 2:27 AM

No, you cannot "rewrite" a request to a different port.  If you need to change ports, You can redirect.  or You can proxy the request.  You cannot rewrite it.

If you don't understand the distinctions between these things, you need to read the IIRF documentation. 

You should also be aware that you cannot rewrite a request that arrives on one application pool, into another application pool. Again if you don't understand what this means, you should read the IIRF documentation.