302 redirect not regarded, 200 instead

Topics: Developer Forum, User Forum
Oct 4, 2010 at 4:00 PM

Hi there,

I use IIRF to reverse proxy. When I receive a 302 IIRF does not redirect properly. Instead it treats the page as being a successful 200 thus stopping.

Any idea how to have IIRF redirect?

 

 thks

Coordinator
Oct 5, 2010 at 6:51 PM

When you say "When I receive a 302 IIRF does not redirect properly" - what do you mean, specifically? (and precisely) 

What is returning the 302, and TO WHAT is the 302 being returned?   Are you saying that IIRF is getting a 302 from the proxied site, and IIRF is not returning a 302 to the original client?

Can you show me the IIRF log file of a transaction involving this scenario?

I'll have to examine the code to insure that IIRF is doing the right thing when it receives a 302 in a response to a proxied request.

 

Oct 11, 2010 at 3:30 PM

Hi Cheeso,

thanks for your reply and sorry for my sloppy initial posting that was very vage to say the least.
Let me be more precise:

I use the following rules in the IIRF.ini file:

---8<---
RewriteRule         ^/test$            /test/            [I]
ProxyPass           ^/test/(.*)$        http://192.168.0.66/$1    [I]
ProxyPassReverse    ^/test/(.*)$        http://192.168.0.66/$1    [I]
---8<---

on the machine 192.168.0.66 I have a php script (redirect.php) that does a redirect (302) to another file (useme.php) on 192.168.0.66:

redirect.php:
---8<---
<?php header( "Location: useme.php" ); ?>
---8<---

useme.php:
---8<---
<?php echo "useme"; ?>
---8<---

If I access redirect.php via http://192.168.0.66/redirect.php the output is as expected. However, if I access it via IIRF: httpp://192.168.0.20/test/redirect.php I get a blank page as you can see in the HTTP capture of IE:

---8<---
GET /test/redirect.php HTTP/1.1
Accept: */*
Accept-Language: en-gb
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Host: 192.168.0.20
Connection: Keep-Alive
X-NovINet: v1.2

HTTP/1.1 302 302 Moved Temporarily
Date: Mon, 11 Oct 2010 13:59:42 GMT
Server: Microsoft-IIS/6.0
Date: Mon, 11 Oct 2010 13:59:47 GMT
Location: useme.phpContent-type: text/html
Content-Length: 0
Via: 1.1 192.168.0.20 (IIRF v2.1)
---8<---

Note the broken parts in the reponse <Location>, two times the status code.

I also add the according log file entry:

---8<---
Mon Oct 11 16:11:12 -  3460 - HttpFilterProc: SF_NOTIFY_URL_MAP
Mon Oct 11 16:11:12 -  3460 - HttpFilterProc: cfg= 0x012751C0
Mon Oct 11 16:11:12 -  3460 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Mon Oct 11 16:11:12 -  3460 - DoRewrites
Mon Oct 11 16:11:12 -  3460 - DoRewrites: Url (no decoding): '/test/redirect.php'
Mon Oct 11 16:11:12 -  3460 - EvaluateRules: depth=0
Mon Oct 11 16:11:12 -  3460 - EvaluateRules: no RewriteBase
Mon Oct 11 16:11:12 -  3460 - EvaluateRules: Rule 1: -1 (No match)
Mon Oct 11 16:11:12 -  3460 - EvaluateRules: Rule 2: -1 (No match)
Mon Oct 11 16:11:12 -  3460 - EvaluateRules: Rule 3: -1 (No match)
Mon Oct 11 16:11:12 -  3460 - EvaluateRules: Rule 4: 2 matches
Mon Oct 11 16:11:12 -  3460 - EvaluateRules: Result (length 32): http://192.168.0.66/redirect.php
Mon Oct 11 16:11:12 -  3460 - EvaluateRules: returning 999
Mon Oct 11 16:11:12 -  3460 - DoRewrites: Proxy to: 'http://192.168.0.66/redirect.php'
Mon Oct 11 16:11:12 -  3460 - IirfProxy_SendRequest: http://192.168.0.66/redirect.php
Mon Oct 11 16:11:12 -  3460 - ParseAllRaw: found 9 headers
Mon Oct 11 16:11:12 -  3460 - GenProxyRequestHeadersString: rh(0x012748B8) nh(192.168.0.66) sn(192.168.0.20) la(192.168.0.20) ra(10.10.10.10) ts(0)
Mon Oct 11 16:11:12 -  3460 - DoRewrites: Proxy complete: 0 chunks, 0 bytes
---8<---

I hope you can reproduce the error and find a fix for it.

Keep up your great work!

 Cheers,
 Juergen

Coordinator
Oct 14, 2010 at 1:15 AM

hi Juergen,

It sure looks like broken behavior to me.  The HTTP headers are not correctly formatted. 

I'll have a look and get back to you.

 

Coordinator
Oct 14, 2010 at 1:22 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Feb 2, 2011 at 11:08 AM

Hi Cheeso,

it is working now! Thanks a lot for this fix, keep up your great work!

Cheers,
Juergen

Coordinator
Feb 2, 2011 at 2:19 PM

Hey, thanks for the confirmation.