Url is rewritten according to log but throws 404 on "original" url

Topics: Developer Forum, User Forum
Apr 6, 2011 at 3:45 PM

Hello,

 

I'm using the latest version of IIRF on my local machine in IIS 7.5 in Windows 7. All my rewrite rules work like supposed, except for one rule. I use a reverse proxy rule which must redirect call to specific paths to another domain. These rules were originally from an Apache environment.

I'm using the following 2 rules to redirect a request with form POST-data to an external domain. But when I check this in Firebug or etner the url directly in the browser, it throwns a 404 not found on my original url instead of the rewritten url. When I check the IIRF log file, it seems (to me) that IIRF is doing the redirect like it is supposed.

RewriteRule ^/NetCommandService/dynamic(.+)$ https://www.externaldomain.net/NetCommandService/dynamic$1 [P,L]
ProxyPassReverse /NetCommandService/dynamic/ https://www.externaldomain.net/NetCommandService/dynamic

 

See the IIRF log below:

Wed Apr 06 17:28:06 -  5952 - DoRewrites: Url (no decoding): '/NetCommandService/dynamic;QSESSIONID=26683B333ED6F61DF2B869735B78A1C8?QSESSIONID=26683B333ED6F61DF2B869735B78A1C8'
Wed Apr 06 17:28:06 -  5952 - EvaluateRules: depth=0
Wed Apr 06 17:28:06 -  5952 - EvaluateRules: no RewriteBase
Wed Apr 06 17:28:06 -  5952 - EvaluateRules: Rule 1: 2 match
Wed Apr 06 17:28:06 -  5952 - EvaluateRules: Result (length 144): https://www.externaldomain.net/NetCommandService/dynamic;QSESSIONID=26683B333ED6F61DF2B869735B78A1C8?QSESSIONID=26683B333ED6F61DF2B869735B78A1C8
Wed Apr 06 17:28:06 -  5952 - EvaluateRules: returning 999
Wed Apr 06 17:28:06 -  5952 - DoRewrites: Proxy to: 'https://www.externaldomain.net/NetCommandService/dynamic;QSESSIONID=26683B333ED6F61DF2B869735B78A1C8?QSESSIONID=26683B333ED6F61DF2B869735B78A1C8'
Wed Apr 06 17:28:06 -  5952 - IirfProxy_SendRequest: https://www.externaldomain.net/NetCommandService/dynamic;QSESSIONID=26683B333ED6F61DF2B869735B78A1C8?QSESSIONID=26683B333ED6F61DF2B869735B78A1C8
Wed Apr 06 17:28:06 -  5952 - DoRewrites: requires rewrite to: '/proxy.iirf?path=/LM/W3SVC/5/ROOT&url=https://www.externaldomain.net/NetCommandService/dynamic;QSESSIONID=26683B333ED6F61DF2B869735B78A1C8?QSESSIONID=26683B333ED6F61DF2B869735B78A1C8'
Wed Apr 06 17:28:06 -  5952 - HttpFilterProc: SF_NOTIFY_URL_MAP
Wed Apr 06 17:28:06 -  5952 - HttpFilterProc: cfg= 0x01CD1CD8
Wed Apr 06 17:28:06 -  5952 - HttpFilterProc: SF_NOTIFY_LOG
Wed Apr 06 17:28:06 -  6536 - DoRewrites: Proxy complete: 1 chunks, 2545 bytes'

 

What is going wrong here and how can I get this rule to work?

 

Coordinator
Apr 7, 2011 at 2:54 PM

Hmm, interesting situation. It's hard to know what's going wrong.

I agree that it appears from the log, that IIRF is doing what you expect.  You may want to turn up the log level in IIRF to get more information.

Also I know you said "latest" but can you please confirm exactly what version of IIRF you are using.  There's a version ID that is printed in the IIRF log file when IIRF starts up.  Older versions didn't handle proxying properly.

If you are capable of using Firebug then you will probably also be able to use an http debugging proxy, like Fiddler.  It's free.  Download it and configure it, and it will show you exactly what HTTP data gets transmitted and received, between the browser and the IIS/IIRF machine. This may give you further insight.

It won't show the data transmitted between IIS/IIRF and the proxied target, but you can infer that. (The headers will show in the IIRF log at higher log levels)

 

Apr 11, 2011 at 1:22 PM
Edited Apr 11, 2011 at 2:31 PM

Hi Cheeso,

I'm using this version of IIRF: 2.1.1.25 x86 RELEASE

I used HttpFox to inspect the HTTP data but it did not give me more information, except that i Noticed that the url it is requesting from my local system is:

Requested URL http://customer.localhost.efocus.local:80/proxy.iirf?path=/LM/W3SVC/5/ROOT&url=https://www.externaldomain.net/NetCommandService/dynamic;QSESSIONID=45AFD1C07AB491B6AD7BA2A4ECD44BCB?QSESSIONID=45AFD1C07AB491B6AD7BA2A4ECD44BCB
Physical Path D:\Web\Customer\Public\Website\proxy.iirf
   
 


This urls /proxy.iirf seems to throw the 404. Is it correct that the url is in this format? And might there be an issue with handling the proy.iirf extension? (I have added the *.iirf handler mapping in IIS)

 

Update:

I somehow managed to make the proxy rule work, but there is no POST-data sent to the external url. It seems that this option is not working but I can't explain why?