简体   繁体   中英

How's 504 response header handled in ajax request in jquery?

I have an ajax call from client, that looks like that:

$.ajax({
            'url': '/converter/ajax-make-corrections/',
            'data': {

                corrections: JSON.stringify(globalCorrrectionsObject)
            },
            type: 'POST',
            success: function(data) {

            }
        })

This action send pretty big file to server to do some server job. The trouble is that there is timelimit on server - 30 minutes. After that server closes a connection with 504 errror (here is what I see in nginx access log file):

[06/May/2015:09:13:33 +0300] "POST /converter/ajax-make-corrections/ HTTP/1.1" 504

and at the same tim in nginx error.log file

*1799741 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 

There is no errors in apache log.

And here is what happened: action from browser was restarted 9 times exactly 30 minutes after each other. Since action in browser can not be start manually second time with same data, my best guess is that $.ajax action was restarting itself after getting 504 response. Is it possible? How $.ajax handles 504 response? Will it restart itself sending same data again?

$.ajax action was restarting itself after getting 504 response. Is it possible? Will it restart itself sending same data again?

In this particular case, I would say no . There is nothing in the script you provided that makes it possible to make a request.

How $.ajax handles 504 response?

error: function (request, status, error) {
    alert(request.responseText);
}

Also try to increase max_execution_time

ini_set('max_execution_time', 3600); //1 hour

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM