RewriteProxy problem with AJAX call

Helicon Ape provides support for Apache .htacces and .htpasswd configuration files for Microsoft IIS.
User avatar
Posts: 16
Joined: 20 Nov 2013, 13:10

RewriteProxy problem with AJAX call

27 Aug 2014, 12:39

Hi!

We are using Helicon Ape 3.1.0.138 as Reverse Proxy for an ASP.NET Application.

Since we need to forward the authentication information we use
RewriteProxy ^/(Appname/.*) http://appserver/$1 [A]

This works fine for normal Requests, but when AJAX-Calls are used the Proxying to the Appserver works, but the Response is not sent back to the Browser.

Logfile:
[2014-08-27 17:07:37.565] [proxy] (debug) [/Appname/] request to http://appserver/Appname/?sessionid=abcdefgh
[2014-08-27 17:07:46.816] [proxy] (debug) [/Appname/jQGrid/LoadjqDataPending] request to http://appserver/Appname/jQGrid/LoadjqDataPending


Here is the request captured with Wireshark on the main webserver:

ORIGINAL-Request
----------------
POST /Appname/jQGrid/LoadjqDataPending HTTP/1.1
X-Requested-With: XMLHttpRequest
X-HttpWatch-RID: 6503-10122
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Accept: application/json, text/javascript, */*; q=0.01
Referer: https://abc.myserver.at/Appname/?sessionid=abcdefgh
Accept-Language: de-AT
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Host: abc.myserver.at
Content-Length: 63
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: ASP.NET_SessionId=godef0hdcnu2tqljsydulqzy
Authorization: Basic [myuserandpassword]
[some POSTData]

FORWARDED-Request
-----------------
POST /Appname/jQGrid/LoadjqDataPending HTTP/1.1
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Accept: application/json, text/javascript, */*; q=0.01
Accept-Encoding: gzip, deflate
Accept-Language: de-AT
Cookie: ASP.NET_SessionId=godef0hdcnu2tqljsydulqzy
Referer: https://abc.myserver.at/Appname/?sessionid=abcdefgh
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
X-Requested-With: XMLHttpRequest
X-HttpWatch-RID: 6503-10122
X-REQUEST-URI: /Appname/jQGrid/LoadjqDataPending
X-Rewrite-Url: /Appname/jQGrid/LoadjqDataPending
X-Original-Url: /Appname/jQGrid/LoadjqDataPending
X-ISRW-PROXY-AUTH-TYPE: Basic
X-ISRW-PROXY-AUTH-USER: [username]
X-ISRW-PROXY-LOGON_USER: [username]
X-ISRW-PROXY-REMOTE-USER: [username]
X-Forwarded-Host: abc.myserver.at
X-Forwarded-For: [ip-address1]
X-Forwarded-Server: [ip-address2]
Host: appserver
Content-Length: 63
[some POST Data]

Response
--------
HTTP/1.1 200 OK
Cache-Control: private
Content-Type: application/json; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNetMvc-Version: 5.2
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Wed, 27 Aug 2014 14:42:58 GMT
Content-Length: 283

{ some JSON data }


Any ideas why the AJAX-response gets stuck on the main webserver?

thanks!
swobi

User avatar
Posts: 16
Joined: 20 Nov 2013, 13:10

Re: RewriteProxy problem with AJAX call

28 Aug 2014, 09:43

Hi again!

Since we are using ISAPI_Rewrite3 as well (and Anton wrote some while ago that "ISAPI_Rewrite and Ape are not related products and the same directives are realized in a completely different way") I put above RewriteProxy rule into our ISAPI_Rewrite3 httpd.conf and it worked!

So I guess we use ISAPI_Rewrite for this scenario but maybe you could check why this is not working with Ape?

cheers
swobi

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: RewriteProxy problem with AJAX call

28 Aug 2014, 10:22

Hi swobi,

This should be working. Are you using HeliconApe only among our products?

Regards

User avatar
Posts: 16
Joined: 20 Nov 2013, 13:10

Re: RewriteProxy problem with AJAX call

28 Aug 2014, 10:48

Hello!

>> Are you using HeliconApe only among our products?

Unfortunately not; additionally we have to use
- Tomcat/JBOSS Redirector (ISAPI)
- Old Application Server Redirector (ISAPI)

ISAPI_Rewrite is used with NotificationType=PREPROC_HEADERS so the rewrites take place before the other stuff.

Is there a way to trace the Request through all those layers? (FailedRequestLog File is not written in the error case)
Perhaps with IIS Event Tracing?

thanks!
swobi

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: RewriteProxy problem with AJAX call

01 Sep 2014, 10:46

Hello,


FailedRequestLog File is not written in the error case


FailedRequestLog is the correct way of debugging IIS. If it's not working, this means either something is wrong or the request didn't make it to IIS. HeliconApe can't affect FailedRequestLog and break it, so you'd need to investigate this one.


Regards

Return to Helicon Ape

Who is online

Users browsing this forum: No registered users and 0 guests