IIRF Adding Data to URL

Topics: User Forum
Aug 20, 2010 at 6:16 PM

Running IIRF on IIS6, Win2k3 

Some, but not all buttons on a site (built using VB .NET and AJAX) end up adding extra data to the URLs they post back, as if a line break is being missed.

For example, instead of reading site.com/page.aspx, iirf gets and tries to send the user to site.com/page.aspxCache-Control:%20no-cache

Here's the ini file:

 

#IIRF.ini
StatusInquiry ON
RewriteLog C:\WINDOWS\system32\LogFiles\iirf\iirfLog.PAMSPPubRewriteLogLevel 3
RewriteRule ^(.*)\.iirf(.*) - [L,I]
ProxyPass ^/(.*)$ http://www.pamsp.koryak.net:8880/$1

Here's the log information:

Fri Aug 20 13:03:06 -  3664 - -------------------------------------------------------
Fri Aug 20 13:03:06 -  3664 - Ionic ISAPI Rewriting Filter (IIRF) 2.1.1.23 x86 RELEASE
Fri Aug 20 13:03:06 -  3664 - IIRF was built on: May 30 2010 13:26:57
Fri Aug 20 13:03:06 -  3664 - Cached: DLL_PROCESS_ATTACH
Fri Aug 20 13:03:06 -  3664 - Cached: Process ID: 3696
Fri Aug 20 13:03:06 -  3664 - Cached: ReadServerConfig: C:\Program Files\Ionic Shade\IIRF 2.1\IirfGlobal.ini(23): Filter Priority is now: HIGH (0x80000)
Fri Aug 20 13:03:06 -  3664 - Cached: ReadServerConfig: C:\Program Files\Ionic Shade\IIRF 2.1\IirfGlobal.ini(46): NotifyLog setting is now: OFF
Fri Aug 20 13:03:06 -  3664 - Cached: ReadServerConfig: C:\Program Files\Ionic Shade\IIRF 2.1\IirfGlobal.ini(63): RewriteEngine setting is now: ON
Fri Aug 20 13:03:06 -  3664 - Cached: DLL_PROCESS_ATTACH - complete
Fri Aug 20 13:03:06 -  3664 - Cached: GetFilterVersion
Fri Aug 20 13:03:06 -  3664 - GetLogFile: app:'/LM/W3SVC/1950144643/Root'  new log:'C:\WINDOWS\system32\LogFiles\iirf\iirfLog.PAMSPPub.3696.log'
Fri Aug 20 13:03:06 -  3664 - ReadVdirConfig: actual log file 'C:\WINDOWS\system32\LogFiles\iirf\iirfLog.PAMSPPub.3696.log'
Fri Aug 20 13:03:06 -  3664 - ReadVdirConfig: ini file: 'E:\PAMSP\PAMSPcom\Iirf.ini'
Fri Aug 20 13:03:06 -  3664 - ReadVdirConfig: ini file timestamp: 2010/08/13 12:01:21 Eastern Daylight Time
Fri Aug 20 13:03:06 -  3664 - ReadVdirConfig: cfg(0x012343D0)
Fri Aug 20 13:03:06 -  3664 - ReadVdirConfig: LogLevel = 3
Fri Aug 20 13:03:06 -  3664 - ReadVdirConfig: E:\PAMSP\PAMSPcom\Iirf.ini(3): StatusInquiry ON (--) (--)
Fri Aug 20 13:03:06 -  3664 - ReadVdirConfig: E:\PAMSP\PAMSPcom\Iirf.ini(3): IIRF Status Inquiry is enabled at path '/iirfStatus' for local requests only.
Fri Aug 20 13:03:06 -  3664 - ReadVdirConfig: E:\PAMSP\PAMSPcom\Iirf.ini(8): RewriteRule (rule 1)  '^(.*)\.iirf(.*)'  '-'    [L,I]
Fri Aug 20 13:03:06 -  3664 - ReadVdirConfig: E:\PAMSP\PAMSPcom\Iirf.ini(10): ProxyPass (rule 2)  '^/(.*)$'  'http://www.pamsp.koryak.net:8880/$1'   (null)
Fri Aug 20 13:03:06 -  3664 - ReadVdirConfig: Done reading INI for the root vdir, found 2 rules (0 errors, 0 warnings) on 11 lines
Fri Aug 20 13:03:06 -  3664 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Aug 20 13:03:06 -  3664 - HttpFilterProc: cfg= 0x012343D0
Fri Aug 20 13:03:06 -  3664 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Fri Aug 20 13:03:06 -  3664 - DoRewrites
Fri Aug 20 13:03:06 -  3664 - DoRewrites: Url (no decoding): '/IIRF.ini'
Fri Aug 20 13:03:06 -  3664 - EvaluateRules: depth=0
Fri Aug 20 13:03:06 -  3664 - EvaluateRules: no RewriteBase
Fri Aug 20 13:03:06 -  3664 - EvaluateRules: Rule 1: -1 (No match)
Fri Aug 20 13:03:06 -  3664 - EvaluateRules: Rule 2: 2 matches
Fri Aug 20 13:03:06 -  3664 - EvaluateRules: Result (length 41): http://www.pamsp.koryak.net:8880/IIRF.ini
Fri Aug 20 13:03:06 -  3664 - EvaluateRules: returning 999
Fri Aug 20 13:03:06 -  3664 - DoRewrites: Proxy to: 'http://www.pamsp.koryak.net:8880/IIRF.ini'
Fri Aug 20 13:03:06 -  3664 - IirfProxy_SendRequest: http://www.pamsp.koryak.net:8880/IIRF.ini
Fri Aug 20 13:03:06 -  3664 - ParseAllRaw: found 7 headers
Fri Aug 20 13:03:06 -  3664 - GenProxyRequestHeadersString: rh(0x01234078) nh(www.pamsp.koryak.net) sn(www.pamsp.koryak.net) la(192.168.101.70) ra(192.168.101.1) ts(0)
Fri Aug 20 13:03:07 -  3664 - DoRewrites: Proxy complete: 2 chunks, 1635 bytes'
Fri Aug 20 13:14:47 -  3664 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Aug 20 13:14:47 -  3664 - HttpFilterProc: cfg= 0x012343D0
Fri Aug 20 13:14:47 -  3664 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Fri Aug 20 13:14:47 -  3664 - DoRewrites
Fri Aug 20 13:14:47 -  3664 - DoRewrites: Url (no decoding): '/Login.aspx'
Fri Aug 20 13:14:47 -  3664 - EvaluateRules: depth=0
Fri Aug 20 13:14:47 -  3664 - EvaluateRules: no RewriteBase
Fri Aug 20 13:14:47 -  3664 - EvaluateRules: Rule 1: -1 (No match)
Fri Aug 20 13:14:47 -  3664 - EvaluateRules: Rule 2: 2 matches
Fri Aug 20 13:14:47 -  3664 - EvaluateRules: Result (length 43): http://www.pamsp.koryak.net:8880/Login.aspx
Fri Aug 20 13:14:47 -  3664 - EvaluateRules: returning 999
Fri Aug 20 13:14:47 -  3664 - DoRewrites: Proxy to: 'http://www.pamsp.koryak.net:8880/Login.aspx'
Fri Aug 20 13:14:47 -  3664 - IirfProxy_SendRequest: http://www.pamsp.koryak.net:8880/Login.aspx
Fri Aug 20 13:14:47 -  3664 - DoRewrites: requires rewrite to: '/proxy.iirf?path=/LM/W3SVC/1950144643/Root&url=http://www.pamsp.koryak.net:8880/Login.aspx'
Fri Aug 20 13:14:47 -  3664 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Aug 20 13:14:47 -  3664 - HttpFilterProc: cfg= 0x012343D0
Fri Aug 20 13:14:47 -  3664 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Aug 20 13:14:47 -  3664 - HttpFilterProc: cfg= 0x012343D0
Fri Aug 20 13:14:47 -  3664 - HttpExtensionProc: Proxy to 'http://www.pamsp.koryak.net:8880/Login.aspx'
Fri Aug 20 13:14:47 -  3664 - ProxyPostRequest: http://www.pamsp.koryak.net:8880/Login.aspx
Fri Aug 20 13:14:47 -  3664 - ProxyPostRequest: url(http://www.pamsp.koryak.net:8880/Login.aspx)
Fri Aug 20 13:14:47 -  3664 - ParseAllRaw: found 13 headers
Fri Aug 20 13:14:47 -  3664 - GenProxyRequestHeadersString: rh(0x01234040) nh(www.pamsp.koryak.net) sn(www.pamsp.koryak.net) la(192.168.101.70) ra(192.168.101.1) ts(1762)
Fri Aug 20 13:14:51 -  3664 - HttpExtensionProc: done
Fri Aug 20 13:14:52 -  3664 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Aug 20 13:14:52 -  3664 - HttpFilterProc: cfg= 0x012343D0
Fri Aug 20 13:14:52 -  3664 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Fri Aug 20 13:14:52 -  3664 - DoRewrites
Fri Aug 20 13:14:52 -  3664 - DoRewrites: Url (no decoding): '/favicon.ico'
Fri Aug 20 13:14:52 -  3664 - EvaluateRules: depth=0
Fri Aug 20 13:14:52 -  3664 - EvaluateRules: no RewriteBase
Fri Aug 20 13:14:52 -  3664 - EvaluateRules: Rule 1: -1 (No match)
Fri Aug 20 13:14:52 -  3664 - EvaluateRules: Rule 2: 2 matches
Fri Aug 20 13:14:52 -  3664 - EvaluateRules: Result (length 44): http://www.pamsp.koryak.net:8880/favicon.ico
Fri Aug 20 13:14:52 -  3664 - EvaluateRules: returning 999
Fri Aug 20 13:14:52 -  3664 - DoRewrites: Proxy to: 'http://www.pamsp.koryak.net:8880/favicon.ico'
Fri Aug 20 13:14:52 -  3664 - IirfProxy_SendRequest: http://www.pamsp.koryak.net:8880/favicon.ico
Fri Aug 20 13:14:52 -  3664 - ParseAllRaw: found 8 headers
Fri Aug 20 13:14:52 -  3664 - GenProxyRequestHeadersString: rh(0x01235768) nh(www.pamsp.koryak.net) sn(www.pamsp.koryak.net) la(192.168.101.70) ra(192.168.101.1) ts(0)
Fri Aug 20 13:14:52 -  3664 - DoRewrites: Proxy complete: 2 chunks, 1635 bytes'
Fri Aug 20 13:14:54 -  3664 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Aug 20 13:14:54 -  3664 - HttpFilterProc: cfg= 0x012343D0
Fri Aug 20 13:14:54 -  3664 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Fri Aug 20 13:14:54 -  3664 - DoRewrites
Fri Aug 20 13:14:54 -  3664 - DoRewrites: Url (no decoding): '/Login.aspx'
Fri Aug 20 13:14:54 -  3664 - EvaluateRules: depth=0
Fri Aug 20 13:14:54 -  3664 - EvaluateRules: no RewriteBase
Fri Aug 20 13:14:54 -  3664 - EvaluateRules: Rule 1: -1 (No match)
Fri Aug 20 13:14:54 -  3664 - EvaluateRules: Rule 2: 2 matches
Fri Aug 20 13:14:54 -  3664 - EvaluateRules: Result (length 43): http://www.pamsp.koryak.net:8880/Login.aspx
Fri Aug 20 13:14:54 -  3664 - EvaluateRules: returning 999
Fri Aug 20 13:14:54 -  3664 - DoRewrites: Proxy to: 'http://www.pamsp.koryak.net:8880/Login.aspx'
Fri Aug 20 13:14:54 -  3664 - IirfProxy_SendRequest: http://www.pamsp.koryak.net:8880/Login.aspx
Fri Aug 20 13:14:54 -  3664 - DoRewrites: requires rewrite to: '/proxy.iirf?path=/LM/W3SVC/1950144643/Root&url=http://www.pamsp.koryak.net:8880/Login.aspx'
Fri Aug 20 13:14:54 -  3664 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Aug 20 13:14:54 -  3664 - HttpFilterProc: cfg= 0x012343D0
Fri Aug 20 13:14:54 -  3664 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Aug 20 13:14:54 -  3664 - HttpFilterProc: cfg= 0x012343D0
Fri Aug 20 13:14:54 -  3664 - HttpExtensionProc: Proxy to 'http://www.pamsp.koryak.net:8880/Login.aspx'
Fri Aug 20 13:14:54 -  3664 - ProxyPostRequest: http://www.pamsp.koryak.net:8880/Login.aspx
Fri Aug 20 13:14:54 -  3664 - ProxyPostRequest: url(http://www.pamsp.koryak.net:8880/Login.aspx)
Fri Aug 20 13:14:54 -  3664 - ParseAllRaw: found 13 headers
Fri Aug 20 13:14:54 -  3664 - GenProxyRequestHeadersString: rh(0x01235790) nh(www.pamsp.koryak.net) sn(www.pamsp.koryak.net) la(192.168.101.70) ra(192.168.101.1) ts(636)
Fri Aug 20 13:14:56 -  3664 - HttpExtensionProc: done
Fri Aug 20 13:14:56 -  3664 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Aug 20 13:14:56 -  3664 - HttpFilterProc: cfg= 0x012343D0
Fri Aug 20 13:14:56 -  3664 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Fri Aug 20 13:14:56 -  3664 - DoRewrites
Fri Aug 20 13:14:56 -  3664 - DoRewrites: Url (decoded): '/Default.aspxSet-Cookie: PAMSPPublicLogin=5AB6DF51898D40A5C658A8FB6FDE223F8698B8824FAD94B11BB59B91B18D9DA978FAD01A46E992D149C86BB524D87261310D3F529BF1DF7AFD4474F927803973; path=/; HttpOnly'
Fri Aug 20 13:14:56 -  3664 - EvaluateRules: depth=0
Fri Aug 20 13:14:56 -  3664 - EvaluateRules: no RewriteBase
Fri Aug 20 13:14:56 -  3664 - EvaluateRules: Rule 1: -1 (No match)
Fri Aug 20 13:14:56 -  3664 - EvaluateRules: Rule 2: 2 matches
Fri Aug 20 13:14:56 -  3664 - EvaluateRules: Result (length 220): http://www.pamsp.koryak.net:8880/Default.aspxSet-Cookie: PAMSPPublicLogin=5AB6DF51898D40A5C658A8FB6FDE223F8698B8824FAD94B11BB59B91B18D9DA978FAD01A46E992D149C86BB524D87261310D3F529BF1DF7AFD4474F927803973; path=/; HttpOnly
Fri Aug 20 13:14:56 -  3664 - EvaluateRules: returning 999
Fri Aug 20 13:14:56 -  3664 - DoRewrites: Proxy to: 'http://www.pamsp.koryak.net:8880/Default.aspxSet-Cookie: PAMSPPublicLogin=5AB6DF51898D40A5C658A8FB6FDE223F8698B8824FAD94B11BB59B91B18D9DA978FAD01A46E992D149C86BB524D87261310D3F529BF1DF7AFD4474F927803973; path=/; HttpOnly'
Fri Aug 20 13:14:56 -  3664 - IirfProxy_SendRequest: http://www.pamsp.koryak.net:8880/Default.aspxSet-Cookie: PAMSPPublicLogin=5AB6DF51898D40A5C658A8FB6FDE223F8698B8824FAD94B11BB59B91B18D9DA978FAD01A46E992D149C86BB524D87261310D3F529BF1DF7AFD4474F927803973; path=/; HttpOnly
Fri Aug 20 13:14:56 -  3664 - ParseAllRaw: found 10 headers
Fri Aug 20 13:14:56 -  3664 - GenProxyRequestHeadersString: rh(0x01234040) nh(www.pamsp.koryak.net) sn(www.pamsp.koryak.net) la(192.168.101.70) ra(192.168.101.1) ts(0)
Fri Aug 20 13:14:56 -  3664 - DoRewrites: Proxy complete: 2 chunks, 1635 bytes'
Fri Aug 20 13:14:56 -  3664 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Aug 20 13:14:56 -  3664 - HttpFilterProc: cfg= 0x012343D0
Fri Aug 20 13:14:56 -  3664 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Fri Aug 20 13:14:56 -  3664 - DoRewrites
Fri Aug 20 13:14:56 -  3664 - DoRewrites: Url (no decoding): '/favicon.ico'
Fri Aug 20 13:14:56 -  3664 - EvaluateRules: depth=0
Fri Aug 20 13:14:56 -  3664 - EvaluateRules: no RewriteBase
Fri Aug 20 13:14:56 -  3664 - EvaluateRules: Rule 1: -1 (No match)
Fri Aug 20 13:14:56 -  3664 - EvaluateRules: Rule 2: 2 matches
Fri Aug 20 13:14:56 -  3664 - EvaluateRules: Result (length 44): http://www.pamsp.koryak.net:8880/favicon.ico
Fri Aug 20 13:14:56 -  3664 - EvaluateRules: returning 999
Fri Aug 20 13:14:56 -  3664 - DoRewrites: Proxy to: 'http://www.pamsp.koryak.net:8880/favicon.ico'
Fri Aug 20 13:14:56 -  3664 - IirfProxy_SendRequest: http://www.pamsp.koryak.net:8880/favicon.ico
Fri Aug 20 13:14:56 -  3664 - ParseAllRaw: found 8 headers
Fri Aug 20 13:14:56 -  3664 - GenProxyRequestHeadersString: rh(0x01235A98) nh(www.pamsp.koryak.net) sn(www.pamsp.koryak.net) la(192.168.101.70) ra(192.168.101.1) ts(0)
Fri Aug 20 13:14:56 -  3664 - DoRewrites: Proxy complete: 2 chunks, 1635 bytes'

Coordinator
Aug 22, 2010 at 1:42 PM
Hmm. Why do you have a rule for .iirf urls in there? It should not be necessary, and it may be affecting the operation of the filter.
Aug 23, 2010 at 2:18 PM

That was an attempt to prevent calls to the ISAPI extension from being proxied. Without it or something similar, no buttons that invoke a postback work/

I changed my .ini file to this:

# IIRF.ini

StatusInquiry ON

RewriteLog C:\WINDOWS\system32\LogFiles\iirf\iirfLog.PAMSPPub
RewriteLogLevel 3

ProxyPass ^/(?!.*\.iirf)(.*)$ http://www.pamsp.koryak.net:8880/$1
And it still does the same thing. On this particular site it seems to only be the login buttons- ones that are transmitting user information- that fail in this particular way.

Aug 25, 2010 at 12:57 PM

I found myself having the same problem as you while trying to proxy Redmine though IIS. To solve this, I had to modify the source code and compile my own version. The problem was actually that no line feed were inserted after the Location header. Unfortunately I haven’t gotten around posting this in the issue tracker yet…

In the file proxy.c around line 605, change:

else if (_strnicmp(p,"Content-Location: ", strlen("Content-Location: "))==0 ||
		 _strnicmp(p,"Location: ", strlen("Location: "))==0) {
	// transform
	char * newHdr = IirfProxy_GetPprSubstHeaderString(cfg, p, cfg->rootPpr, serverName, port, https);
	if (pass==0) {
		sz += strlen(newHdr) ;
	}
	else {
		strcat_s(newHeaderString, sz, newHdr);
		newHdr[strlen(newHdr)-2]='\0';
		LogMessage(cfg, 5, "ProcessResponseHeaders: transform old '%s'", p);
		LogMessage(cfg, 5, "ProcessResponseHeaders:           new '%s'", newHdr);
	}
	free(newHdr);
}

to

else if (_strnicmp(p,"Content-Location: ", strlen("Content-Location: "))==0 ||
		 _strnicmp(p,"Location: ", strlen("Location: "))==0) {
	// transform
	char * newHdr = IirfProxy_GetPprSubstHeaderString(cfg, p, cfg->rootPpr, serverName, port, https);
	if (pass==0) {
		sz += strlen(newHdr) + 2;
	}
	else {
		strcat_s(newHeaderString, sz, newHdr);
		strcat_s(newHeaderString, sz, "\r\n");
		newHdr[strlen(newHdr)-2]='\0';
		LogMessage(cfg, 5, "ProcessResponseHeaders: transform old '%s'", p);
		LogMessage(cfg, 5, "ProcessResponseHeaders:           new '%s'", newHdr);
	}
	free(newHdr);
}

The patch looks like this:

610c610
<                     sz += strlen(newHdr) ;
---
>                     sz += strlen(newHdr) + 2;
613a614
> 					strcat_s(newHeaderString, sz, "\r\n");

Hopefully this will solve the problem for you too without introducing any new problems.

Coordinator
Aug 31, 2010 at 12:50 AM
I'm glad you were able to fix the problem for yourself. I'll have to look more closely at the suggested patch before accepting it. The line following your 2nd change seems to indicate that a /r/n sequence was expected to be present in the newHdr variable.
Coordinator
Aug 31, 2010 at 12:51 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.