502 Proxy Error

502 Proxy Error

ImAProgrammerImAProgrammer Posts: 4Questions: 1Answers: 1

Hi,

I have problem with datatables + ajax.
It displayed the following error:

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

If I inspect it on chrome's network tab. The detail is as follow:

Request URL: http://xxx.xxx.xxx/URL
Request Method: POST
Status Code: 502 Proxy Error

Notes:
We have several other AJAX function using JQUERY but they're running fine.
The proxy error only happened with datatables.

Many thanks and much appreciated for any hint/ helps.

Thank you

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @ImAProgrammer ,

    I'm surprised that it would only happen with the DataTables - all it would do is issue a standard request. When you say it works for other services, is that to the same URL? Have you checked the logs on the gateway to see if there are any clues in there?

    Cheers,

    Colin

  • ImAProgrammerImAProgrammer Posts: 4Questions: 1Answers: 1
    edited June 2018

    HI Colin,

    Thank you for replying.

    When you say it works for other services, is that to the same URL?

    Yes the url is almost identical. The only difference is the end point.

    For example:
    The datatables ajax url is:
    http://example.com/api/datatables

    The other jquery ajax url is:
    http://example.com/api/another_functions

    Have you checked the logs on the gateway to see if there are any clues in there?

    Yes, the logs from the gateway server says this:
    Internal error: proxy: error reading status line from remote server, referer: http://example.com/url_of_the_ajax_caliing_page

    And

    Proxy: error reading from remote server returned by /api/url, referer: http://example.com/url_of_the_ajax_caliing_page

    Have you never found cases like this before?

    Many thanks

  • allanallan Posts: 63,471Questions: 1Answers: 10,467 Site admin

    What happens if you call the end point directly through your browser, rather than using DataTables' Ajax?

    Allan

  • ImAProgrammerImAProgrammer Posts: 4Questions: 1Answers: 1

    Hi Allan,

    We're using PIMCORE which is based on Symphony and the endpoint is only callable via AJAX request.
    If we tried to call it directly it will response with 404 not found.

    Thank you

  • allanallan Posts: 63,471Questions: 1Answers: 10,467 Site admin

    Do something like $.ajax( { url: ... } ); from your browser's console in that case. That will be a plain jQuery Ajax request to see how it responds.

    Allan

  • ImAProgrammerImAProgrammer Posts: 4Questions: 1Answers: 1
    edited June 2018 Answer ✓

    Hi Allan,

    Please close this thread because I have found the problems.
    It turns out that our reverse proxy is causing the error.
    There's no problem with datatables.
    Many thanks for everyone's supports and help.

    Thank you.

  • walshcottwalshcott Posts: 2Questions: 0Answers: 0

    The 502 Bad Gateway Error is an indication that something has gone wrong within the server of your application, as opposed to the client side request.

    How to Fix a 502 Error

    Perform a hard-refresh in your browser. On Macs, this is done by pressing Cmd + Shift + R.

    This problem is due to poor IP communication between back-end computers, possibly including the Web server at the site you are trying to visit. Before analysing this problem, you should clear your browser cache completely.

    If you get this problem for only some of the Web sites you try to visit then it is likely to be a problem at those sites i.e. one of their pieces of equipment is failing/overloaded. Contact the people at those sites.

    If you are surfing the Web and see this problem for all Web sites you try to visit, then either 1) your ISP has a major equipment failure/overload or 2) there is something wrong with your internal Internet connection e.g. your firewall is not functioning correctly. In the first case, only your ISP can help you. In the second case, you need to fix whatever it is that is preventing you reaching the Internet.

    In some cases, this error caused by low computer hard disk space, you can go check the free space of your computer hard disk. If there is really not enough free space left, clean your computer hard disk well.

    Start your browser in Safe Mode. Running a browser in Safe Mode means to run it with default settings and without add-ons or extensions, including toolbars.

    If your web application is configured to listen on a socket, ensure that the socket exists in the correct location and that it has the proper permissions

    Finally, restart your computer/networking equipment. Some temporary issues with your computer and how it's connecting to your network could be causing 502 errors, especially if you're seeing the error on more than one website. In these cases, a restart would help.

This discussion has been closed.