“HTTP 502 Bad Gateway” Error and Solution


The HyperText Transfer Protocol (HTTP) 502 Bad Gateway the server error is generated when an invalid response is received from a server. “502 Bad Gateway” is an HTTP status code that is defined and standardized with RFC. The “502 Bad Gateway” status code is defined in RFC 10.5.3.

What Is “HTTP 502 Bad Gateway” Error?

HTTP uses status codes in order to provide information about the HTTP request between client and servers. Every HTTP request will return a HTTP status code like successful, failed, warning etc. The web is complex where some servers can make HTTP request to other servers too. “HTTP 502 Bad Gateway” is a status code is mainly returned from a server where this server make some request to other server and can not get information and “HTTP 502 Bad Gateway” is returned to the user.

“HTTP 502 Bad Gateway” Expressions

Even the canonical name for the “HTTP 502 Bad Gateway” is used to express the error but there are other expressions to show this error. The following errors are generally used for the web.

  • 502 Bad Gateway
  • 502 Service Temporarily Overloaded
  • Error 502
  • Temporary Error (502)
  • 502 Proxy Error
  • 502 Server Error: The server encountered a temporary error and could not complete your request
  • HTTP 502
  • 502. That’s an error
  • Bad Gateway: The proxy server received an invalid response from an upstream server
  • HTTP Error 502 – Bad Gateway
  • 502 Bad Gateway NGINX
  • A blank white screen

Also other than different applications, software, operating systems uses the web for different purposes and can get “HTTP 502 Bad Gateway” error and print in different forms.

LEARN MORE  What Is CGI (Common Gateway Interface)?

Windows Update requires to access th update servers which uses HTTP protocol to get information. The following error is returned which is related with the “HTTP 502 Bad Gateway” status code.

0x80244021 error code or the message WU_E_PT_HTTP_STATUS_BAD_GATEWAY

Google provides a lot of web related services like Gmail, Google Search, Google Cloud, Google Drive Google Map etc. These service may return the “HTTP 502 Bad Gateway” error like below.

HTTP 502 Bad Gateway Error For Google Services

Linux Package Management command named “apt-get” uses HTTP in order to get recent package information and issue an “Error 502 Bad Gateway” error.

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/main/source/Sources  502  Bad Gateway [IP: 91.189.91.13 80]
HTTP 502 Bad Gateway Error For Ubuntu Apt-Get

Linux Yum is another package manager for RPM based distributions and the HTTP 502 Error is expressed like below.

error was [Errno 14] HTTP Error 502: Bad Gateway
HTTP 502 Bad Gateway Error For Yum Command

What Cause “HTTP 502 Bad Gateway” Error?

“HTTP 502 Bad Gateway” error is mainly related to the communication problems between intermediate servers. This means we have no control over this error.

  • Browser Problem
  • DNS Problem
  • Firewall Configuration
  • Internet Access
  • Remote Website Problem
  • Server Overload
  • Website Software Error

Microsoft IIS “HTTP 502 Bad Gateway” SubStatus Information

Microsoft IIS version 7.0 and later provides more detailed information about the “HTTP 502 Bad Gateway” error. It provides sub status code like “502.1”, “502.2” where every sub status code provides a specific case. This sub status information is not standard and only provided by the Microsoft IIS server.

  • 502.1 – CGI application timeout.
  • 502.2 – Bad gateway: Premature Exit.
  • 502.3 – Bad Gateway: Forwarder Connection Error (ARR).
  • 502.4 – Bad Gateway: No Server (ARR).
LEARN MORE  HTTP Status Codes

How To Fix /Solve “HTTP 502 Bad Gateway” Error?

The “HTTP 502 Bad Gateway” error can be solved in different ways. Event the error is mainly related with the remote server or network there are some basic checks in order to fix or overcome this error.

Client Side Solutions

Reload URL is the first and most practical way to solve this error. “F5” or refresh button of the web browser can be used. Actually this will not fix the problem directly but just make a check if the problem continue or not.

Start New Session is another quick fix where previous sessions garbage will be omitted.

Clear your browser cache where outdated or corrupted files that are stored in the browser will be removed which can cause “HTTP 502 Bad Gateway” error.

Delete Cookies because previosuly stored cookies will use old values for an HTTP connection which can be cause of the “502 Bad Gateway” error.

Start Browsers in Safe/Private Mode which will omit previously craeted sessions and site preferences and prevent “502 Error”.

Try Different Browser where current browser may have problems. Try different browser like Google Chrome, Mozilla Firefox, Microsoft Edge, Opera, Internet Explorer, Safari etc.

Disable Security Softwarewhere security software can block suspicious even legitimate action. Security software like Microsoft Defender, Kaspersky Endpoint Protection, Microsoft Forefront, TrendMicro Endpoint Protection etc. generally monitors network traffic and stops suspicious connections.

Restart Computer because some temporary configuration may prevent access to network and create “HTTP 502 Bad Gateway” error.

Restart Network Devices because they provide access to the internet and problem related with these devices will interrupt internet access which will cause “Bad Gateway Error”.

Change DNS Server is related with your computer or router. Some “HTTP 502 Bad Gateway” errors are related with the DNS server errors or restrictions.

LEARN MORE  HTML Div Tag Usage Tutorial with Examples

Server/Network Side Solutions

Contact website owner is responsible for the website you want to access. The problem may be related with the website architecture where you can contact website owner for the problem.

Contact ISP because the internet connection is provided by the ISP where it can be responsible for the “502 Bad Gateway” error.

Check origin server where it can be down for the CDN architecture.

Check Firewall Configuration and Logswhere server firewall can prevent some transfer between client or servers which will cause “HTTP 502 Bad Gateway” error.

Check Server Software where it may provide faulty responses or create unnecessary overload.

Check Server Services where services may be unreliable. If it is possible to restart the services and look for configuration changes.

Check Database Server because slow queries slowdown the websites and cause sow responses which will end with timeout and “HTTP 502 Bad Gateway” error.

Check Hosting Provider where there may a system or network problem related to the hosting which effects the web site.

Different “HTTP 502 Bad Gateway” Error Pages

Below we will list some popular services “HTTP 502 Bad Gateway” error pages.

Cloudflare

HTTP 502 Bad Gateway Error For Cloudflare
HTTP 502 Bad Gateway Error For Cloudflare

GoDaddy

HTTP 502 Bad Gateway Error For GoDaddy

Twitter

HTTP 502 Bad Gateway Error For Twitter

Google

HTTP 502 Bad Gateway Error For Google

Microsoft IIS

HTTP 502 Bad Gateway Error For IIS

Nginx

HTTP 502 Bad Gateway Error For Nginx

Leave a Comment