What do you mean, 502 bad gateway?

Source: Internet
Author: User
Tags http request socket domain name server browser cache

Cause

502 Bad Gateway

Servers (which can be not Web servers) are gateways or proxies that meet customer requirements (such as Web browsers or our Checkupdown bots) to access the requested URL.   This server received an invalid response from an upstream server to fulfill its requirements. Meaning: This usually does not mean that the upstream server has been shut down (no response gateway/proxy), but that the upstream server and gateway/proxy disagree with the protocol exchange data. Since the Internet protocol is fairly clear, it often means that one or two machines have been improperly or incompletely programmed.

Error cycle

Any client (such as a Web browser or our Checkupdown robot) communicates with your Web server after the following loops: Gets the IP name of your site's IP address (the leader of your site's URL, ' http://').   This finds (converts the intellectual property name, IP address) provided by the Domain name server (DNSS).   Open an IP socket to connect to the IP address.   Write an HTTP data stream through the socket. Received an HTTP data stream from your response Web server. This data flow contains the value of the status code by the HTTP protocol.   Resolves the status code and other useful information for this data flow. When this error occurs in the last step, the client above receives an HTTP status code that confirms 502 '.

Fixed error

Generally this problem is due to poor IP communication between the backend computers, including the websites you may try to access on the Web server.   In analyzing this problem, you should completely clear the browser cache.   If you look at this problem on all the sites you're trying to access on the Internet, there are two possibilities 1 your ISP has a major device failure/overload 2 The internal Internet connection is problematic if your firewall does not function properly. In the first case, only your ISP can help you. In the second case, you will need to resolve any problems that prevent you from accessing the Internet. If you only have this problem in a part of the Web site you're trying to access, it's probably a problem--one of those sites that has a device failure or overload. Contact the administrator of the Web site.

Checkupdown Error

Increased use of proxies and caching on the network. Our Checkupdown machine will always try to connect to the real computer host, which is actually the website you visit, but we are not fully controlled, our HTTP request is actually over. If only one link of the computer processing our HTTP request is broken, then an error such as 502 can easily occur.

Solutions

  A popular explanation.

1. What is 502 Bad Gateway error

In short, 502 is an error type code bad Gateway

2. Causes of Errors

Connection Timeout We send a request to the server because the server is currently linked too much, causing the server to not give the normal response, resulting in such an error, as follows:

First reason:

DNS Buffering. The usual reason for this is that you have visited a Web site like Facebook without a VPN open.

This time the natural access is not, but also left a buffer in this machine.

This situation is usually available within a few minutes. You can also try running Ipconfig/flushdns in a DOS window

This command refreshes the DNS buffer.

Second reason:

Your browser has an agent or something. Make sure you turn off the agent.

A third reason:

DNS has been hijacked, even with foreign DNS, to be hijacked.

Some machines open VPN to access,

Some of the machines are definitely not.

and excludes the agent, firewall, local network reasons.

Ping the remote site at the same time, such as Facebook.

Inaccessible machines typically acquire a weird IP, pinging IP from anywhere.

and can access the IP, in the machine can not access the direct access, you can ping pass.

In this case, we can remove DNS from the VPN server. Switch to additional DNS.

In a Windows system, you can in the properties of the local network connection,

Remove the default DNS, choose foreign DNS, such as Google's. or OpenDNS.

3. Means of salvation

The best solution, of course, is to do it on the server. It is not possible for everyone, so what is the way to save? IS--refresh (not the general refresh OH).

The principle of refreshing: Many people may not know that there are two types of refreshes. The so-called refresh is actually from the server to download data to the local hard disk browser, and then from the local hard disk to read data to the browser to show us.

① Basic refresh: That is, click Refresh or use F5 shortcut key to refresh only from the local hard disk to pick up data to the browser, do not send a request to the server again. Most users are often so refreshed, encountered 502 of the error will have no effect.

② from the server refresh: If you re-click on the page you want to browse the link, you will find that the page is still showing 502 bad Getway now can be normal browsing!

Do you understand? When you click on the page you want to browse the link, it will be downloaded from the server data.   The workaround is to refresh from the server: shortcut key Ctrl+f5, which is to resend the request to the server. If the server can give you a normal response you can see the page.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.