Forum Discussion

ashish_solanki's avatar
Mar 18, 2022
Solved

502 Bad Gateway Error

Hi All,

My app lication team is getting error 502 Bad Gateway when they try to access below URL:

For eg: www.xyz.com/lib/dict.en-US.json 

Below is the traffic flow.

Public --->>> DNS --> CDN ---> F5 --|||-> LB (10.x.x.x) ---> Apache servers (10.x.x.x1 & x2)

I have few policies on VIP which says if the request comes with above URI redirect it to a new pool.

I told app team 502 error is related to server only. Can someone hele here what things I can check on F5 to tshoot this issue.

Thanks,

  • Hi ashish_solanki,

    pity you have to prove your innocence here. My standard answer to such accusations usually is: "The BIG-IP does not send a HTML page unless it is configured to do so."

    Before you make such a bold statement with confidence, you should check that your configuration on the BIG-IP is correct. You can do the following to further analyze the issue and to verify your config is working as intended:

    • Try curl from the BIG-IP to /lib/dict.en-US.json on the Apache servers directly. Check that you get the correct response from the backend server.
    • Capture traffic between BIG-IP and backend server with tcpdump. This should show that the 502 status page is sent by the web application server. And also this will verify that the request is arriving at the correct Apache servers. 
      If you are not experienced with tcpdump - start from here: K411: Overview of packet tracing with the tcpdump utility 
    • Capture traffic going to the web application server when you access /lib/dict.en-US.json directly.
      Compare differences - maybe you find a solution in the differences.

    Good luck,
    Daniel

2 Replies

  • Hi ashish_solanki,

    pity you have to prove your innocence here. My standard answer to such accusations usually is: "The BIG-IP does not send a HTML page unless it is configured to do so."

    Before you make such a bold statement with confidence, you should check that your configuration on the BIG-IP is correct. You can do the following to further analyze the issue and to verify your config is working as intended:

    • Try curl from the BIG-IP to /lib/dict.en-US.json on the Apache servers directly. Check that you get the correct response from the backend server.
    • Capture traffic between BIG-IP and backend server with tcpdump. This should show that the 502 status page is sent by the web application server. And also this will verify that the request is arriving at the correct Apache servers. 
      If you are not experienced with tcpdump - start from here: K411: Overview of packet tracing with the tcpdump utility 
    • Capture traffic going to the web application server when you access /lib/dict.en-US.json directly.
      Compare differences - maybe you find a solution in the differences.

    Good luck,
    Daniel

  • This error indicates that a server acting as a gateway or proxy has received an invalid response from an upstream server. This can occur due to various reasons, such as a server outage, network connectivity issues, or incorrect server settings.

    When a user encounters this error code 502 Bad gateway, it means that the server acting as a gateway or proxy was unable to receive a valid response from the upstream server, and as a result, the requested content cannot be displayed. To resolve this error, the user should try reloading the page or waiting for a few minutes before trying again. If the error persists, the user should contact the website administrator or IT department for assistance in resolving the issue.

    If you are experiencing 502 errors on multiple websites, it is possible that temporary issues with your computer or network equipment could be causing the problem. Restarting your computer and networking equipment may help to resolve these issues. Therefore, it is recommended to restart your computer and networking equipment to see if this resolves the 502 error.