IIRF Rewrite to IIS subapplications (POST-Request)

Topics: Developer Forum, Project Management Forum, User Forum
Dec 1, 2010 at 6:43 PM
Edited Dec 2, 2010 at 10:13 AM

Hi.

I have:

two domain names (firstDomain.com, secondDomain.com) linked to one server with my site. The site has some virtual directories (applications)

What I want:

Rewrite all requests like this:

http://firstDomain.com          ->     http://firstDomain.com/firstVirtualDirInIIS

http://secondDomain.com     ->     http://firstDomain.com/secondVirtualDirInIIS

My IIRF.ini:

RewriteCond %{HTTP_HOST} ^www\.firstDomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^firstDomain\.com$
RewriteRule ^/(.*)      /firstVirtualDirInIIS/$1 [L]

 
RewriteCond %{HTTP_HOST} ^www\.secondDomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^secondDomain\.com$
RewriteRule ^/(.*)      /secondVirtualDirInIIS/$1 [L]

All good, but if I do postback (POST-request) nothing happens.

Question:

What is wrong? How can I realize POST-request to myDomainName.com as it would be myDomainName.com/VirtualDirectory/

 

Thank you in advance!

Coordinator
Dec 3, 2010 at 11:16 PM

I don't know what's wrong.  Your IIRF logfile may give some clues.

I'm not clear what you're asking with that second question.  I don't know what you mean; maybe you could rephrase it.

 

Dec 4, 2010 at 5:09 AM
Edited Dec 4, 2010 at 5:16 AM

Hi, Cheeso!

Thank you for supporting.

I'll try to rephrase my question. I need to rewrite all requests (GET, POST...) from domain names to subappl. in IIS. All GET-request are fine, but POST-requests are not coming to applications.

Looks like POST does not go through IIRF and changed to GET stuff.

IIRF.ini:

RewriteCond %{HTTP_HOST} ^(www\.)?myDomain\.ru
RewriteRule ^/(.*)      /subApplication/$1 [L]

IIRFStatus:

iirfStatus

Logs:

load debug log file

Cheeso, thank you for helping me!

Coordinator
Dec 4, 2010 at 10:31 AM

ok, I understand.

I looked in your log file and I don't see evidence of a failure. Maybe you could be specific.

in the log there are requests for a Contacts.aspx form.  It is a POST request and it appears to be handled correctly. Does that match with what you see?

Which specific POST requests do you see, failing? And how do they fail?

You said:

> Looks like POST does not go through IIRF and changed to GET stuff.

But I saw POST requests in the IIRF log, and they did not appear to be getting changed into GET.

There's something strange in your log file, too.  The POST request for Contacts.aspx gets rewritten, and then is immediately (within one second) followed by a GET request for RIm.aspx, which is also rewritten.  This pair of rewrites occured repeatedly in the log file about 10 times.  If you were simply testing a single request, why is there this repeated set of requests?   I think maybe your contacts.aspx form may be redirecting itself.

I can suggest that you test a POST request with a simpler form, something that does almost nothing.  Perhaps it only displays the posted information on the web page.  For diagnostics purposes only.  I think you'll see that the POST works.  The IIRF log is not conclusive, but if I had to guess, I would say that it appears to me that your your ASPNET logic is introducing the unwanted rewrite-and-change-POST-to-GET .

Cheers.

 

 

Coordinator
Dec 4, 2010 at 10:35 AM

Another possibility is that you inadvertently have installed IIRF multiple times, once at the site level and once at the server level.  It could be that we are looking only at one IIRF log, and there is another IIRF with a different configuration that is doing something odd.  The same could happen if you have another rewriter installed.

In order to troubleshoot *this* IIRF install, you will need to get the POST request for Contacts.aspx (or some other ASPNET page) to result in ONE request at IIRF.  If I see a cascade of Contacts.aspx, RIm.aspx, Contacts.aspx, RIm.aspx, and so on... in the IIRF logfile, then I can conclude there is a logic error somewhere in your system - either in your ASPNET code or in another rewriter that I don't know about - causing the never-ending series of rewrites and requests. 

good luck.

Dec 4, 2010 at 12:50 PM

I was trying to deploy new simple Web Application in IIS and all are ok. So mostly my code is wrong. It is a good news =).

Thank you for your help. I'll try to fix it as you said before and will write you bakc.

Regards.

Dec 4, 2010 at 8:59 PM

Hi, Cheeso!

Problem was in my code: that was my custom redirecting. IIRF's funtionality solves many problems I faced.

Thank you very much!!!

Sincerely,

                                  Anatoly Lozovoi.

 

Coordinator
Dec 5, 2010 at 8:31 PM

Ahh, there ya go.

Glad to hear you've sorted it.