How Can You Fix Cloudflare Error 520?
Cloudflare error 520 occurs when the server receives an invalid HTTP response or is unable to interpret the request in the least and isn’t ready to proceed further. There may be two reasons about the error, either the server was overloaded, or a program started running out of resources and must be terminated.
Here are the given steps that you can follow to fix the Cloudflare error on your program:
- Look For Error Logs:
Usually, error 520 clears itself if you try to refresh the page. If you see an error 520 code regularly, it means that there is an unexpected resetting of one of your devices. On your Cloudflare web server, you can check every time the error occurs, and the connection resets. You can easily compare the data to the uptime on the load balancer, origin server, firewall, or another network. You can reboot or reconfigure the update of your device.
- Restart PHP On The Origin Server:
You should also check if your PHP application is over-consuming the system resources or crashing. You can clear the error 520 by restarting the application that is affected. We recommend that you schedule regular reboots to prevent your website from crashing and overloading. To perform automatic reboots, you can create a cron job to prevent error 520.
- Whitelist The Origin Server IP AddressOf Cloudflare:
It would help if you allowed the origin server because it is a part of built-in security protocols for Cloudflare. If you don’t let the connection, the server cannot identify the IP address. As a result, it shows error 520. Make sure to whitelist all the CNAME’s related to your web server in the DNS setting. This also helps in preventing error 520 and other similar errors.
- Check The Response Headers:
The missing response headers are one of the most common effects of 520 error. From your Cloudflare server, check the origin response headers. There are many sources of missing response header; you can use different debugger tools to help trace requests and the data. If there is a response from an outdated agent, there may be a connection coming from old versions of Safari or Internet Explorer. It is essential to make sure that the web design of your site is compatible with the common web browsers.
- Delete Your Cookies:
Make sure to have a simple web design for your website to not rely on cookies to handle the requests. Sometimes error 520 occurs because of the cookies, as they increase the size of the HTTP response header, and Cloudflare restricts the header size limit to less than 8kb. To check the number of cookies you are using, you can access the HAR files of your server. If the headers are more than 8kb, you need to ask your web developer to manage these cookies.
- Correct The DNS Setting Of The Cloudflare Origin Server:
If your site does not have HTTP status code information, the response from your web server will be empty. This indicates that the hosting provider of your web server configuration is outdated. To fix this, you’ll contact your hosting provider. It takes around 72 hours for the DNS settings to spread around your website. After updating the DNS settings, you mustn’t forget to clear the website’s cache and the WordPress’s cache installed on the website.
- Server Traffic Examination:
The first and foremost step is to check if there is any unusual traffic on the webserver. Make sure that you filter the requests on port 80. This helps in restricting suspicious traffic and blocking spam because all these issues can cause the occurrence of error 520. If you see the recurrence of the same IP address in a short period, we recommend you block such connections. You can even check your error log to permit proxy IP addresses. It takes a very long time to receive the response from the origin server, even if the permitted traffic has valid headers. These timeouts can also result in error 520, and look into the HAR records to check if there are any requests which contain bulky response bodies.
- In The Cloudflare Logs, Look For The Non-HTTP Errors:
If your server cannot recognize even the incoming requests, it is because of the error 520. You see this error very often when there is a gateway timeout because of non-HTTP errors. You can review the network hardware or your system resource for any crashed or stalled services in such a situation.
Kinex Media is a team of well-trained web developers, web designers, SEO, and digital marketers who can provide you with over-the-counter solutions for your website. We can redesign your website or create a new one as per your choice. We are the experts in fixing website issues. We can also help you to attract more traffic towards your website, which would convert into sales. The websites we design are very responsive and take no time in loading; we optimize the websites so that they are accessible on every web browser. For more information, you can visit our website and contact us through the phone number provided. You might get a chance to win exciting offers too.