Ajax Error with Load Balancer

Ajax Error with Load Balancer

jdonnell01jdonnell01 Posts: 3Questions: 1Answers: 0
edited April 2019 in Free community support

I occasionally receive the below Ajax error (404 Not Found) when using a load balancer across (2) application instances:

DataTables warning: table id=DataTables_Table_0 - Ajax error. For more information about this error, please see http://datatables.net/tn/7

I am unable to enable sticky sessions on my load balancer to ensure the app hits the same worker every time to avoid the 404 Not Found error. Is it possible to configure the Ajax request to hit the same worker for the duration of a session? This would act as a compensating solution as I cannot enable sticky sessions on my load balancer. I initially enabled client-side processing on my tables to avoid the error, however the tables are large so in Internet Explorer performance was severely degraded.

Thank you

Answers

  • kthorngrenkthorngren Posts: 20,317Questions: 26Answers: 4,772

    I'm not sure specifically what can be done. Maybe the developers have a solution for you. Datatables passes the Ajax request through to jQuery's ajax method. While waiting for a response here you may want to look for solutions using jQuery's ajax and apply them to the ajax option config.

    Kevin

  • allanallan Posts: 61,740Questions: 1Answers: 10,111 Site admin

    I'm also not sure that much can be done on the client-side here. It sounds like the load balancer has a flaw in it. Is it returning 404 if the session is active on a different worker but the load balancer hits another worker? I don't see how that can be resolved with anything but sticky sessions on the load balancer. As you say, you need the client to hit the same worker each time, but that's purely down to the load balancer (perhaps unless the balancer sends back information about the IP address for the specific worker in the first request - but I seriously doubt the setup will do that).

    Allan

  • jdonnell01jdonnell01 Posts: 3Questions: 1Answers: 0
    edited April 2019

    Understood - thank you for the reply. Correct - I receive the 404 when the session is active on one worker and then when I reload the page the load balancer redirects to the other worker. As long as the app keeps hitting the same worker there is no issue. This error seems to only happen on Chrome, not IE or Firefox. Do you have any notion as to why this would only be affected on Chrome?

  • jdonnell01jdonnell01 Posts: 3Questions: 1Answers: 0
    edited April 2019

    @allan & @kthorngren I tried to use the ajax option and manually set the URL to one of my workers so the ajax request gets forwarded to the same worker every time. However, I get an error 'Invalid JSON Response'. Or do you know if there is a way I can grab the current URL of the client to make sure the ajax request goes to the correct worker? Again this is only a problem in Chrome - still not sure why that is.

    Any suggestions would be appreciated.
    Thank you

This discussion has been closed.