Pls help me ProxyPass at form submission

Topics: User Forum
Aug 11, 2010 at 7:19 AM

Hi Cheeso and experienced users,

I have managed to get ProxyPass v2.1 working, thanks to very detailed and comprehensive documentation.

Things work fine when I ProxyPass a html file which contains a form.  But when I submit the form.  It always gave an error "HTTP Error 404 - File or directory not found".

What could be the probable cause?

I have tools like IIRF log, status enquire & Fiddlers ready (as you guys suggested).  I can compare logs between successful proxying and failed proxying, between successful form submission (bypassing IIRF) and failed submission.  But I don't know what items ( individual HTTP headers, Stayalives, etc) are changeable, should be changed, and how. 

Thanks a lot.

Michael

Aug 11, 2010 at 7:34 AM

Hi Michael,

Hmm... how about posting some logs and potentially html src including iirf.ini files?

/Wolfgang

Aug 11, 2010 at 3:39 PM
Edited Aug 11, 2010 at 4:36 PM

Thanks Wolfgang.

Here is my Iirf.ini:

StatusInquiry ON

RewriteLogLevel 4

RewriteLog C:\data\Ex_Files_ASP_NET_EssT\Exercise Files\Ch01GettingStarted\cswHelloWorld\iirf

ProxyPass ^/cswhelloworld(.*)$ http://192.168.1.153/$1

The servers in question live at my home, which includes:

192.168.1.156 is Win2003 w/ IIS, and of course IIRF.

192.168.1.153 is Linux w/ Apache.

So, with a little bit of patience please go url:

http://59.148.24.178/cswhelloworld/form1.html

and simulate my problem.

Oh yes, the IIRF log (log level 4). As follows:

*********FOR THE SUCCESSFUL DISPLAY (404) OF form1.html, LOG IS HERE:****************************

Wed Aug 11 22:27:05 - 3784 - IsIniFileUpdated: C:\data\Ex_Files_ASP_NET_EssT\Exercise

Files\Ch01GettingStarted\cswHelloWorld\Iirf.ini NO

Wed Aug 11 22:27:05 - 3784 - GetVdirConfig: Obtain vdir '/LM/W3SVC/1/Root/cswhelloworld' (era=0) (rc=3) (Expired=0) (ptr=0x01D343B0)...

Wed Aug 11 22:27:05 - 3784 - HttpFilterProc: SF_NOTIFY_URL_MAP

Wed Aug 11 22:27:05 - 3784 - HttpFilterProc: cfg= 0x01D343B0

Wed Aug 11 22:27:05 - 3784 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE

Wed Aug 11 22:27:05 - 3784 - DoRewrites

Wed Aug 11 22:27:05 - 3784 - GetHeader_AutoFree: 'url' = '/cswhelloworld/form1.html'

Wed Aug 11 22:27:05 - 3784 - GetHeader_AutoFree: 'method' = 'GET'

Wed Aug 11 22:27:05 - 3784 - DoRewrites: New Url, before decoding: '/cswhelloworld/form1.html'

Wed Aug 11 22:27:05 - 3784 - DoRewrites: Url (no decoding): '/cswhelloworld/form1.html'

Wed Aug 11 22:27:05 - 3784 - EvaluateRules: depth=0

Wed Aug 11 22:27:05 - 3784 - EvaluateRules: no RewriteBase

Wed Aug 11 22:27:05 - 3784 - EvaluateRules: Rule 1: pattern: ^/cswhelloworld(.*)$ subject: /cswhelloworld/form1.html

Wed Aug 11 22:27:05 - 3784 - EvaluateRules: Rule 1: 2 match

Wed Aug 11 22:27:05 - 3784 - ReplaceServerVariables: alloc 24 bytes

Wed Aug 11 22:27:05 - 3784 - ReplaceServerVariables: in='http://192.168.1.153/$1' out='http://192.168.1.153/$1'

Wed Aug 11 22:27:05 - 3784 - GenerateReplacementString: alloc 40 bytes

Wed Aug 11 22:27:05 - 3784 - GenerateReplacementString: result 'http://192.168.1.153//form1.html'

Wed Aug 11 22:27:05 - 3784 - EvaluateRules: Result (length 32): http://192.168.1.153//form1.html

Wed Aug 11 22:27:05 - 3784 - EvaluateRules: returning 999

Wed Aug 11 22:27:05 - 3784 - DoRewrites: Proxy to: 'http://192.168.1.153//form1.html'

Wed Aug 11 22:27:05 - 3784 - IirfProxy_SendRequest: http://192.168.1.153//form1.html

Wed Aug 11 22:27:05 - 3784 - ProxyRequest: host(192.168.1.153) path+query(//form1.html)

Wed Aug 11 22:27:05 - 3784 - ParseAllRaw: Cache-Control: max-age=0

Connection: keep-alive

Keep-Alive: 115

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Accept-Encoding: gzip,deflate

Accept-Language: en-us,en;q=0.5

Host: 59.148.24.178

If-Modified-Since: Wed, 11 Aug 2010 14:24:09 GMT

If-None-Match: "100000001ef9a-226-48d8d00bbab5b"

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 GTB7.1 (.NET CLR 3.5.30729)

Wed Aug 11 22:27:05 - 3784 - ParseAllRaw: hdr Cache-Control: max-age=0

Wed Aug 11 22:27:05 - 3784 - ParseAllRaw: hdr Connection: keep-alive

Wed Aug 11 22:27:05 - 3784 - ParseAllRaw: hdr Keep-Alive: 115

Wed Aug 11 22:27:05 - 3784 - ParseAllRaw: hdr Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Wed Aug 11 22:27:05 - 3784 - ParseAllRaw: hdr Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Wed Aug 11 22:27:05 - 3784 - ParseAllRaw: hdr Accept-Encoding: gzip,deflate

Wed Aug 11 22:27:05 - 3784 - ParseAllRaw: hdr Accept-Language: en-us,en;q=0.5

Wed Aug 11 22:27:05 - 3784 - ParseAllRaw: hdr Host: 59.148.24.178

Wed Aug 11 22:27:05 - 3784 - ParseAllRaw: hdr If-Modified-Since: Wed, 11 Aug 2010 14:24:09 GMT

Wed Aug 11 22:27:05 - 3784 - ParseAllRaw: hdr If-None-Match: "100000001ef9a-226-48d8d00bbab5b"

Wed Aug 11 22:27:05 - 3784 - ParseAllRaw: hdr User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 GTB7.1 (.NET CLR 3.5.30729)

Wed Aug 11 22:27:05 - 3784 - ParseAllRaw: found 11 headers

Wed Aug 11 22:27:05 - 3784 - GenProxyRequestHeadersString: rh(0x01D34EA0) nh(192.168.1.153) sn(59.148.24.178) la(192.168.1.156) ra(203.186.80.125) ts(0)

Wed Aug 11 22:27:05 - 3784 - ProxyRequest: WinHttpConnect 192.168.1.153 80

Wed Aug 11 22:27:05 - 3784 - ProxyRequest: WinHttpOpenRequest: GET //form1.html

Wed Aug 11 22:27:05 - 3784 - ProxyRequest: WinHttpAddRequestHeaders

Wed Aug 11 22:27:05 - 3784 - ProxyRequest: WinHttpSendRequest

Wed Aug 11 22:27:05 - 3784 - ProxyRequest: WinHttpReceiveResponse

Wed Aug 11 22:27:05 - 3784 - ProxyRequest: WinHttpQueryHeaders

Wed Aug 11 22:27:05 - 3784 - ProxyRequest: WinHttpQueryHeaders: status 304

Wed Aug 11 22:27:05 - 3784 - Proxy_SetResponseHeaders: starting status 304

Wed Aug 11 22:27:05 - 3784 - Proxy_SetResponseHeaders: status NOT 200, not TIMEOUT

Wed Aug 11 22:27:05 - 3784 - ProcessResponseHeaders: all Date: Wed, 11 Aug 2010 14:30:14 GMT

Connection: Keep-Alive

Keep-Alive: timeout=5, max=100

ETag: "100000001ef9a-226-48d8d00bbab5b"

Via: 1.1 192.168.1.156 (IIRF v2.1)

Wed Aug 11 22:27:05 - 3784 - ProxyRequest: chunks(0) totalBytes(0)

Wed Aug 11 22:27:05 - 3784 - DoRewrites: Proxy complete: 0 chunks, 0 bytes'

Wed Aug 11 22:27:05 - 3784 - ReleaseOrExpireVdirConfig: vdir '/LM/W3SVC/1/Root/cswhelloworld' (era=0) (rc=2) (Expired=0) (ptr=0x01D343B0)...

*********FOR THE UNSUCCESSFUL DISPLAY (404) OF form1.php, LOG IS HERE:****************************

Wed Aug 11 22:28:04 - 3784 - IsIniFileUpdated: C:\data\Ex_Files_ASP_NET_EssT\Exercise Files\Ch01GettingStarted\cswHelloWorld\Iirf.ini NO

Wed Aug 11 22:28:04 - 3784 - GetVdirConfig: Obtain vdir '/LM/W3SVC/1/Root/cswhelloworld' (era=0) (rc=3) (Expired=0) (ptr=0x01D343B0)...

Wed Aug 11 22:28:04 - 3784 - HttpFilterProc: SF_NOTIFY_URL_MAP

Wed Aug 11 22:28:04 - 3784 - HttpFilterProc: cfg= 0x01D343B0

Wed Aug 11 22:28:04 - 3784 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE

Wed Aug 11 22:28:04 - 3784 - DoRewrites

Wed Aug 11 22:28:04 - 3784 - GetHeader_AutoFree: 'url' = '/cswhelloworld/form1.php'

Wed Aug 11 22:28:04 - 3784 - GetHeader_AutoFree: 'method' = 'POST'

Wed Aug 11 22:28:04 - 3784 - DoRewrites: New Url, before decoding: '/cswhelloworld/form1.php'

Wed Aug 11 22:28:04 - 3784 - DoRewrites: Url (no decoding): '/cswhelloworld/form1.php'

Wed Aug 11 22:28:04 - 3784 - EvaluateRules: depth=0

Wed Aug 11 22:28:04 - 3784 - EvaluateRules: no RewriteBase

Wed Aug 11 22:28:04 - 3784 - EvaluateRules: Rule 1: pattern: ^/cswhelloworld(.*)$ subject: /cswhelloworld/form1.php

Wed Aug 11 22:28:04 - 3784 - EvaluateRules: Rule 1: 2 match

Wed Aug 11 22:28:04 - 3784 - ReplaceServerVariables: alloc 24 bytes

Wed Aug 11 22:28:04 - 3784 - ReplaceServerVariables: in='http://192.168.1.153/$1' out='http://192.168.1.153/$1'

Wed Aug 11 22:28:04 - 3784 - GenerateReplacementString: alloc 39 bytes

Wed Aug 11 22:28:04 - 3784 - GenerateReplacementString: result 'http://192.168.1.153//form1.php'

Wed Aug 11 22:28:04 - 3784 - EvaluateRules: Result (length 31): http://192.168.1.153//form1.php

Wed Aug 11 22:28:04 - 3784 - EvaluateRules: returning 999

Wed Aug 11 22:28:04 - 3784 - DoRewrites: Proxy to: 'http://192.168.1.153//form1.php'

Wed Aug 11 22:28:04 - 3784 - IirfProxy_SendRequest: http://192.168.1.153//form1.php

Wed Aug 11 22:28:04 - 3784 - DoRewrites: requires rewrite to: '/proxy.iirf?path=/LM/W3SVC/1/Root/cswhelloworld&url=http://192.168.1.153//form1.php'

Wed Aug 11 22:28:04 - 3784 - HttpFilterProc: SF_NOTIFY_URL_MAP

Wed Aug 11 22:28:04 - 3784 - HttpFilterProc: cfg= 0x01D343B0

Wed Aug 11 22:28:04 - 3784 - ReleaseOrExpireVdirConfig: vdir '/LM/W3SVC/1/Root/cswhelloworld' (era=0) (rc=3) (Expired=0) (ptr=0x01D343B0)...

Wed Aug 11 22:28:17 - 3784 - IsIniFileUpdated: C:\data\Ex_Files_ASP_NET_EssT\Exercise Files\Ch01GettingStarted\cswHelloWorld\Iirf.ini NO

Wed Aug 11 22:28:17 - 3784 - GetVdirConfig: Obtain vdir '/LM/W3SVC/1/Root/cswhelloworld' (era=0) (rc=4) (Expired=0) (ptr=0x01D343B0)...

Wed Aug 11 22:28:17 - 3784 - HttpFilterProc: SF_NOTIFY_URL_MAP

Wed Aug 11 22:28:17 - 3784 - HttpFilterProc: cfg= 0x01D343B0

Wed Aug 11 22:28:17 - 3784 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE

Wed Aug 11 22:28:17 - 3784 - DoRewrites

Wed Aug 11 22:28:17 - 3784 - GetHeader_AutoFree: 'url' = '/cswhelloworld/iirfStatus'

Wed Aug 11 22:28:17 - 3784 - GetHeader_AutoFree: 'method' = 'GET'

Wed Aug 11 22:28:17 - 3784 - DoRewrites: New Url, before decoding: '/cswhelloworld/iirfStatus'

Wed Aug 11 22:28:17 - 3784 - DoRewrites: Url (no decoding): '/cswhelloworld/iirfStatus'

Wed Aug 11 22:28:17 - 3784 - EvaluateRules: depth=0

Wed Aug 11 22:28:17 - 3784 - EvaluateRules: status inquiry

Wed Aug 11 22:28:17 - 3784 - ReleaseOrExpireVdirConfig: vdir '/LM/W3SVC/1/Root/cswhelloworld' (era=0) (rc=3) (Expired=0) (ptr=0x01D343B0)...

Aug 11, 2010 at 10:49 PM
mswchan wrote:

Thanks Wolfgang.

Here is my Iirf.ini:

StatusInquiry ON

RewriteLogLevel 4

RewriteLog C:\data\Ex_Files_ASP_NET_EssT\Exercise Files\Ch01GettingStarted\cswHelloWorld\iirf

ProxyPass ^/cswhelloworld(.*)$ http://192.168.1.153/$1

[...]  

 

Hi,

Looking at your ini settings and knowing that you are trying to submit a form entry, I am wondering of what method you are using for form data submission. Are you appending a query string?

If so, try replacing ProxyPAss with RewriteRule and add the [P,QSA] modifiers.

RewriteRule ^/cswhelloworld(.*)$ http://192.168.1.153/$1 [P,QSA]

Although ProxyPass refers to RewriteRule in the documentation, ProxyPass is limited to the I and NC modifiers. You may have to use QSA though and since cheeso claims that ProxyPass is the same as RewriteRule with the [P] modifier, I would give adding QSA to that a shot.

Let me know if that works by any chance.

Good luck,
Wolfgang

Aug 12, 2010 at 8:35 AM

Thanks again Wolfgang.

I've found out few things:

1. I made a stupid mistake in Regular Expression. Corrected. But still not work.

2. Thanks for pointing me to a great new direction: query parameter, form submission method, ...

3. So I tried 'method get'.  worked. But 'method post' still not work.

4. Then I googled "iirf method post".  (Previously googling "irrf form", "irrf submission" no luck  ;(   

Saw some previous good advices from Cheeso.

Among others:  http://iirf.codeplex.com/Thread/View.aspx?ThreadId=207070

(In particular, properly re-defining 'iirf' as ISAPI Extension, re-applying to my IIS hierarchy of server, virtual directory)

5. success.

6. I retried. You are right, Your RewriteRule works the same as ProxyPass, in my case.

Thanks a lot.

Coordinator
Aug 12, 2010 at 4:38 PM
wolfy wrote:

Although ProxyPass refers to RewriteRule in the documentation, ProxyPass is limited to the I and NC modifiers. You may have to use QSA though and since cheeso claims that ProxyPass is the same as RewriteRule with the [P] modifier, I would give adding QSA to that a shot....

mswchan wrote:

You are right, Your RewriteRule works the same as ProxyPass, in my case.

yes, the RewriteRule with the [P] modifier is supposed to be the same as ProxyPass with no modifier. I hadn't thought about the difference in the modifiers; using RewriteRule with the [P] option should work fine.

Aug 13, 2010 at 1:56 AM

Chesso and mswchan - Thank you both for your feedback!

mswchan, for regular expressions, I have found a testing site that is absolutely amazing. This link is a must have for admins.

Also, thank you for referencing the thread about setting up the ISAPI filter manually. It seems as if the .iirf extension is secondary and probably not as important - just the fact that the DLL gets loaded may do the trick. I read that before but did not think it was relevant since I had no files with the extension .iirf. Duh!

Having seen that, I will go back as well one more time and use Iirf since both of the other solutions for reverse proxy functionality from IIS6 to Apache2 that I have seen are failing on basic authentication. I can get everything to work except authentication and that just drives me nutsville. I may try as part of a separate threat one more time.

Chesso - thanks again for the clarification on ProxyPass. I may recommend to simply drop that directive since RewriteRule will cover it and more if that will make it easier to maintain the code.

Wolfgang

Coordinator
Aug 13, 2010 at 3:13 AM

The .iirf extension is required to be registered if you want to use ProxyPass (or RewriteRule with [P]) with POST.  

The reason has to do with how ISAPI Filters retrieve data.  It's not possible to retrieve the POST data of an HTTP transaction within an ISAPI Filter. So if proxy is performed on an HTTP transaction with POST data, then IIRF must resort to the ISAPI Extension.  ISAPI Extension is different than ISAPI Filter.  The .iirf extension mapping allows IIRF to forward, to itself, HTTP transactions that need to be proxied, and also have POST data. 

I think this is documented.  

The reason I have both the ProxyPass and the RewriteRule with [P] is to mirror the Apache function, with mod_rewrite and mod_proxy. 

So I'd like to keep them both, only for support of people who know one or the other of those. 

Good luck, all.