Loosing POST data with ISAPIRewrite

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 10
Joined: 30 Aug 2012, 06:11

Loosing POST data with ISAPIRewrite

30 Aug 2012, 06:17

Hello, i have a problem with loosing POST data after rewriting url (not redirecting).

The httpd.conf looks like this:

Code: Select all
RewriteLog "C:\Program Files\Helicon\ISAPI_Rewrite3\Rewrite.log"
RewriteLogLevel 9

RewriteEngine On

RewriteRule ^/en$ /en/pages/default.aspx [L]


On the server side in ASPX codebehind the FORMS collection with post-data is empty. Without rewriting, when i am on url '/en/pages/default.aspx', everything works fine. The server is IIS7.

What's worse, everything is working fine on my local development machine (also IIS7). So my guess is, that the problem is related to some ISAPIREWRITE-IIS7-someKB issue. Anybody can help?

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: Loosing POST data with ISAPIRewrite

30 Aug 2012, 06:58

Hello,

Could you check how configurations of the test server and prod server are different (e.g. different .NET settings).
And also show rewrite.log for the prod machine.

User avatar
Posts: 10
Joined: 30 Aug 2012, 06:11

Re: Loosing POST data with ISAPIRewrite

30 Aug 2012, 07:50

The logfile looks pretty straightforward. Please ignore the map lookup, it works the same way with simple rewrite rule.

Code: Select all
xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx  Thu, 30-Aug-2012  09:44:08 GMT [www.mydomain.com/sid#290191491][rid#339590712/initial] (2) init rewrite engine with requested uri /en
xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx  Thu, 30-Aug-2012  09:44:08 GMT [www.mydomain.com/sid#290191491][rid#339590712/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx  Thu, 30-Aug-2012  09:44:08 GMT [www.mydomain.com/sid#290191491][rid#339590712/initial] (3) applying pattern '^(.*)$' to uri '/en'
xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx  Thu, 30-Aug-2012  09:44:08 GMT [www.mydomain.com/sid#290191491][rid#339590712/initial] (5) map lookup OK: map=k[txt] key=/en -> val=/en/pages/homepage.aspx
xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx  Thu, 30-Aug-2012  09:44:08 GMT [www.mydomain.com/sid#290191491][rid#339590712/initial] (1) Rewrite URL to >> /en/pages/homepage.aspx
xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx  Thu, 30-Aug-2012  09:44:08 GMT [www.mydomain.com/sid#290191491][rid#339590712/initial] (2) rewrite '/en' -> '/en/pages/homepage.aspx'
xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx  Thu, 30-Aug-2012  09:44:08 GMT [www.mydomain.com/sid#290191491][rid#339590712/initial] (2) internal redirect with /en/pages/homepage.aspx [INTERNAL REDIRECT]


What specific settings could be interesting related to this issue? Both environments are windows server 2008, IIS7, .Net 3.5

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: Loosing POST data with ISAPIRewrite

31 Aug 2012, 02:40

Hello,

thanks for the log. At least we can see that ISAPI_Rewrite is working just as expected.
Could you now provide the Fiddler log for the same request for both test and prod environments.

User avatar
Posts: 10
Joined: 30 Aug 2012, 06:11

Re: Loosing POST data with ISAPIRewrite

31 Aug 2012, 03:19

Fiddler details of the requests:

(Sorry for the long lines, i will edit the post later. But you can see, the post data are there, sent to the server.)

DEV:
Code: Select all
POST http://devmachine/cs HTTP/1.1
Host: devmachine
Connection: keep-alive
Content-Length: 3277
Cache-Control: max-age=0
Origin: http://devmachine
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.83 Safari/537.1
Content-Type: application/x-www-form-urlencoded
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Referer: http://devmachine/cs
Accept-Encoding: gzip,deflate,sdch
Accept-Language: cs-CZ,cs;q=0.8
Accept-Charset: windows-1250,utf-8;q=0.7,*;q=0.3

MSOWebPartPage_PostbackSource=&MSOTlPn_SelectedWpId=3


PROD:
Code: Select all
POST http://prodmachine/cs HTTP/1.1
Accept: image/jpeg, image/gif, image/pjpeg, application/x-ms-application, application/xaml+xml, application/x-ms-xbap, */*
Referer: http://prodmachine/cs
Accept-Language: en-us,cs;q=0.5
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
Host: prodmachine
Content-Length: 4688
Connection: Keep-Alive
Pragma: no-cache

MSOWebPartPage_PostbackSource=&MSOTlPn_SelectedWpId=2&ctl00%24ctl00%24buttonSearch.y=12
Last edited by lko on 03 Sep 2012, 07:50, edited 1 time in total.

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: Loosing POST data with ISAPIRewrite

31 Aug 2012, 06:14

Hello,

thanks for the Fiddler logs. Still unclear...
Could you create a test PHP page and make the POST request to it (via ISAPI_Rewrite - you'll need to write a rule for it of course) and see if it will work. Then report us the result.

User avatar
Posts: 10
Joined: 30 Aug 2012, 06:11

Re: Loosing POST data with ISAPIRewrite

03 Sep 2012, 05:29

Still the same results. Simple aspx page..

Code: Select all
<%

    foreach (string key in HttpContext.Current.Request.Form.AllKeys)
    {
        Response.Write(key + " - " + HttpContext.Current.Request.Form[key] + "<br />");
    }
       
%>


Creating POST request with fiddler to rewriten url ( /cs/, the foreach is enumerating empty collection (on PROD server).
Creating POST request with fiddler to original url, the foreach is returning correct collection of post data (on PROD server).
Creating POST request with fiddler to both urls on DEV server, the foreach is returning correct collection of post data (on DEV server).

I am suspecting some weird security policy enabled on the production forbidding "something"...

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: Loosing POST data with ISAPIRewrite

03 Sep 2012, 06:28

I'm sorry, but I asked you to test it with PHP page. And that's important. Could you please do it once again with the PHP test page.

User avatar
Posts: 10
Joined: 30 Aug 2012, 06:11

Re: Loosing POST data with ISAPIRewrite

03 Sep 2012, 07:51

I'm sorry, unfortunately we do not have installed PHP extensions on our production win 2008 / iis7 servers :/

User avatar
Posts: 10
Joined: 30 Aug 2012, 06:11

Re: Loosing POST data with ISAPIRewrite

03 Sep 2012, 08:40

But you are right, problem is somewhere in my asp.net pipeline, on the beginrequest event the data are still there. Thank you very much for your help and time, now it's up to me.

User avatar
Posts: 10
Joined: 30 Aug 2012, 06:11

Re: Loosing POST data with ISAPIRewrite

03 Sep 2012, 09:58

On the other hand, there is somethnig interesting in the diagnostic log. It seems there is some kind of second "child" request creating (line 124), which is POST too, but of course without the post data. Wth does the "GENERAL_CHILD_REQUEST_START" event mean?
http://www.sdilej.eu/pics/433d8cdd19563 ... c8c78e.png

Image

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: Loosing POST data with ISAPIRewrite

04 Sep 2012, 05:35

Hello,

ISAPI_Rewrite can not initiate such event as GENERAL_CHILD_REQUEST_START by design.
.NET can do that if you have wildcard mapping. Please check.

User avatar
Posts: 10
Joined: 30 Aug 2012, 06:11

Re: Loosing POST data with ISAPIRewrite

05 Sep 2012, 15:25

Sure, i understand that. The only wildcard handler mappings we have look like this:

Image
Last edited by lko on 06 Sep 2012, 08:01, edited 1 time in total.

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: Loosing POST data with ISAPIRewrite

06 Sep 2012, 05:27

Please try to temporarily remove these 3 mappings saying ExtensionlessUrlHandler...
They might interfere.

User avatar
Posts: 10
Joined: 30 Aug 2012, 06:11

Re: Loosing POST data with ISAPIRewrite

07 Sep 2012, 10:03

Still no luck, result is the same. But i compared the handlers on my dev machine, and the handlers are there too.

Pool is running under .NET 2.0.

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: Loosing POST data with ISAPIRewrite

11 Sep 2012, 05:49

Hello,

Ok, then these handlers are not the case.

Can you try to disable ISAPI_Rewrite or comment out all RewriteRules and check if the POST data will not be lost.

Also, consider using wFretch to see what happens to your request, that no redirects happen etc.

User avatar
Posts: 10
Joined: 30 Aug 2012, 06:11

Re: Loosing POST data with ISAPIRewrite

11 Sep 2012, 08:19

Yes, without ISAPI_Rewrite everything works fine. Even with enabled ISAPI_Rewrite, but accessing the original url, everything is OK.

I will have a look into Wfetch, thnak you for the tip.

Edit: It looks similar to fiddler, which can display client-server communication, but my problem lies in the server pipeline - what and why is it causing the childrequest.

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: Loosing POST data with ISAPIRewrite

12 Sep 2012, 08:08

Hello,

Could you please try to disable the DefaultDocument module in IIS. And try again.

User avatar
Posts: 2
Joined: 10 Dec 2012, 10:07

Re: Loosing POST data with ISAPIRewrite

10 Dec 2012, 10:11

We have removed the DefaultDocumentModule and the server started throwing Internal Server Error exception. IMHO removing the module cannot help.

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: Loosing POST data with ISAPIRewrite

11 Dec 2012, 07:31

Hello, dka

Could you outline your problem in more details and show the rules you apply.

Next

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 59 guests