开发者

Does sspi module conflicts with ajax ? How to resolve it?

开发者 https://www.devze.com 2023-03-23 12:16 出处:网络
I think the Mod-Auth-SSPI is conflicting my ajax system. Please find the below code - new Ajax.Request(ajaxUrl,

I think the Mod-Auth-SSPI is conflicting my ajax system. Please find the below code -

new Ajax.Request(ajaxUrl,
{
    method:'post',
    parameters: 'json='+json,
    onSuccess: 
    function(transport)
    {
    if (transport.responseText.isJSON())     
    displayInfo(transport.responseText.evalJSON(true)); // error occurs     
    else       
    alert('Damn! It's not working...');   
    },
    onFailure: 
    fun开发者_如何转开发ction()
    { 
        alert(mateErrAjaxUrl) 
    }  
});

it always returns the alert('Damn! It's not working...'). That means the displayInfo is not working or conflicting with something. Can anyone tell me how to resolve it ?

Please note that, Mod-Auth-SSPI is working correctly as per my need.


I had a similar problem with Ajax and Internet Explorer (v6 and 8). If you watch the network traffic, you can see that IE begins by sending an empty POST request (content-length: 0) that trigger the NTLM auth, then send the correct POST with the full body.

The bug happens when IE uses an already established TCP/IP connection to Apache/mod_auth_sspi. With the default settings, mod_auth_sspi let the empty POST request pass through, since the connection has been authentified. And your app receive an empty POST request, which probably puzzles it.

One of the solution is to add the instruction 'SSPIPerRequestAuth On' in your Apache config, as said here :
http://wiki.apache.org/httpd/ModAuthSSPI
(at the time of this writing, the /doc in the source of mod_auth_sspi is unfortunately not up to date)

One other, on a old mod_sspi install, was to add 'MaxKeepAliveRequests 2' and 'KeepAliveTimeout 1', which is dirty but could come to help.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号