520 веб сервер возвратил ошибку

When your site’s visitors see error 520 in their browser, it means Cloudflare is sending the message because your server returned an empty, unknown, or unexpected response.

The 520 error can be approached through troubleshooting first to find the cause and then fixed following these steps.

Let’s jump right in:

Troubleshooting Error 520

Since the 520 error is coming up because of an issue on your server, you can troubleshoot the issue by looking in your error log.

Error 520

An example of error 520 for a website.

Disable Cloudflare

Before you start troubleshooting, it’s necessary to disable Cloudflare. This helps isolate the problem by ensuring the issue can be replicated without Cloudflare being a factor.

Step 1

Start by logging into Cloudflare. Then, find your site on the list and click on it.

The Cloudflare dashboard

Click on your listed site.

Step 2

Next, click on the DNS tab, then on the orange cloud under the Proxy status section in the table. You’ll know Cloudflare was disabled because the cloud will have turned gray.

The DNS tab

Click on the orange cloud to disable Cloudflare.

Pause Cloudflare

Alternatively, you can choose to pause Cloudflare after logging in.

Step 1

Click on your connected site from the list.

The Cloudflare dashboard

Click on your site from the list after logging in.

Step 2

Then, scroll down until you see the Advanced Actions section in the sidebar. Click on the Pause Cloudflare on Site link.

The bottom on the Cloudflare dashboard page

Click on the link to pause Cloudflare.

Step 3

A pop-up will be displayed on the page that asks you to confirm you want to pause Cloudflare. Go ahead and click the Confirm button.

The pop-up to confirm pausing Cloudflare

Click Confirm to pause Cloudflare.

Go into Development Mode

If you don’t want to pause or disable Cloudflare, you can keep it running, but place it in development mode so you can still troubleshoot error 520.

Step 1

After logging into Cloudflare, click the Caching tab toward the top of the page.

Cloudflare’s Caching page

Go to the Caching tab.

Step2

Next, scroll down to the Development Mode section and click the Off toggle button. It should now say “On.”

The Caching page

Turn on development mode by clicking the toggle button.

Checking Your Server’s Error Logs

Now that you have disabled, paused or put Cloudflare into development mode, you can troubleshoot error 520 by checking your server’s error logs.

Finding your error log can vary between hosts so check with yours if you’re unsure of where to find your error logs.

If your hosting provider uses cPanel, you can follow the steps below.

Step 1

Log into cPanel and in the dashboard, go to the Metrics section. Then, click the Errors button.

The cPanel dashboard

Click the Errors button under Metrics.

Step 2

The error log page displays errors in reverse chronological order as well as up to 300 of the most recent messages. The error log may display more messages if you or your host adjusted the settings.

The error log in cPanel

View cPanel’s error log to troubleshoot error 520.

Checking Your Log for Error 520 Using MyKinsta

If you host your WordPress site with Kinsta, you can follow the steps below to check your error log.

Step 1

Log into MyKinsta and click on Sites in the menu on the left. Then, select the site you want to troubleshoot from the list on the page.

The MyKinsta dashboard

Click on Sites in the menu of MyKinsta.

Step 2

Click on the Logs tab. By default, the error log is displayed. If you don’t see anything listed, it’s due to the fact that no errors on your site have occurred.

The Logs tab

If there are any errors, they’re displayed on the Logs tab.

How to Interpret the Error Log

Each message in an error log has a structure. If you understand it, you can interpret the error messages that come up.

[Fri Oct 11 17:00:30 2019] [error] [client 123.4.56.7] error description: /path/to/file/with/error

The date and time of the message are listed first followed by the LogLevel directive which tells you about the severity level of the message.

Next up is the IP address of the client. This is who made the issue appear.

Finally, the actual message is displayed and may contain a path to the affected file.

Here are the LogLevel severity levels which could be listed in your error log’s messages:

  • Emerg – This lets you know the issue is an emergency and the server is unavailable.
  • Alert – Action should be taken immediately if you see this level.
  • Crit – This denotes a critical condition.
  • Error – This means an error has occurred.
  • Warn – A message with this level is a warning about an issue that requires your attention, but isn’t critical.
  • Notice – This means your server is normal, but there are significant details about the condition of your server that is available.
  • Info – General information is available with this level.
  • Debug – These messages contain details when you have debugging enabled.

Use a cURL Command to Troubleshoot Error 520

You can also use a cURL command to troubleshoot error 520 by testing against the origin server.

curl -vso /dev/null --user-agent "Mozilla 5.0" -H "Host: your-site.com" http://123.45.6.789/wp-login.php

Be sure to change “you-site.com” to your actual domain. You also need to update “123.45.6.789” with your site’s IP address. If you changed your login page, you should also change the “wp-login.php” part.

A successful response header would look similar to the example below:

* Hostname was NOT found in DNS cache
*   Trying 123.45.6.789...
* Connected to 123.45.6.789 (123.45.6.789) port 80 (#0)
> GET /login HTTP/1.1
> User-Agent: Mozilla 5.0
> Accept: */*
> Host: your-site.com
>
< HTTP/1.1 200 OK
< Content-Type: text/html
< Date: Day, DD, Month Year Hour:Minute:Second Timezone
{ [12345 bytes data]
* Connection #0 to host 123.45.6.789 left intact

If you see something like this, it means everything’s okay and the site was reached without an error 520 response.

On the other hand, if you see a response header similar to the example below, it means the 520 error has occurred when Cloudflare was active:

* Hostname was NOT found in DNS cache
*   Trying 123.45.6.789...
* Connected to 123.45.6.789 (123.45.6.789) port 80 (#0)
> GET /login HTTP/1.1
> User-Agent: Mozilla 5.0
> Accept: */*
> Host: your-site.com
>
* Empty reply from server
* Connection #0 to host 123.45.6.789 left intact

How to Generate a HAR File

A HAR is an HTTP archive file. It contains archives for requests that are going to the server of origin and also through Cloudflare.

It can help you with troubleshooting because it compares response headers coming from the origin server and Cloudflare when it’s used as a proxy.

It’s also used to confirm that the headers are too large if that’s why error 520 has appeared.

You can create a HAR file with your browser with the steps below:

Chrome

Step 1

Open your browser and right-click on the page. Then, select Inspect.

The page has been right-clicked in Chrome.

Right-click in Chrome and choose Inspect.
Step 2

Once the panel has opened, click the Network tab and make sure there’s a red circle button toward the top, left-hand side of the panel. If it’s gray, click it.

The Chrome developer tool

Be sure the record button is red on the Network tab.
Step 3

Check the Preserve log option next to the record button and then click the clear button.

The Chrome developer tool

Select the option to preserve the log and then click to clear previous messages.
Step 4

Load the page that’s bringing up error 520. Then, right-click anywhere in the messages area of the Chrome developer tool.

Select the Save as HAR with Content and save the file to your computer.

A message in Chrome’s developer tool has been right-clicked.

Save the HAR file to your computer.

Firefox

Step 1

Open Firefox and right-click anywhere on the page. Then, select Inspect Element.

A page has been right-clicked in Firefox.

Select Inspect Element after right-clicking on the page.
Step 2

Go to the Network tab and visit the page that has the 520 error coming up. Right-click on messages in the panel and select the Save All as HAR option.

Save the file to your computer.

The Firefox developer tool Network tab

Right-click and choose to save the HAR file.

Edge

Step 1

Open the Edge browser and right-click the page. Select Inspect from the list.

The Edge browser

Select Inspect after right-clicking in the browser.
Step 2

Go to the Network tab and ensure the circular record button is red. If it’s not, click it. Check the Preserve log option, then the icon to clear the current messages.

The Network tab of the developer tool

Click to preserve the log and clear older messages.
Step 3

Go to the page where you’re experiencing error 520. Then, right-click on the messages in the developer tool panel and select the Save all as HAR with content option.

Save the file to your computer.

Safari

Step 1

Open Safari and right-click on the page for Windows or press CMD on your keyboard and click for Mac. Select Inspect Element from the list.

The Safari browser

Choose the Inspect Element option after right-clicking on the page.
Step 2

Go to the Network tab. Check the Preserve Log option, then go to the page with the error 520 issue.

The Safari developer tool panel

Check the option to preserve the log on the Network tab.
Step 3

Click the Export button and save the HAR file to your computer.

The Safari developer tool

Export the HAR file.

Resolving the Common Reasons for Error 520

Now that you have your error log, search through it and see if you notice any one of the issues below. Then, follow the steps below to resolve the issue.

Origin Server PHP Application Crashed

One common issue that causes error 520 is that one of the PHP applications have crashed on your server. Restarting PHP will fix the error.

Step 1

Using SSH, you can enter the command below for Apache servers:

apache2ctl restart

For Nginx servers, you can restart PHP using the command below:

service nginx restart

Restart PHP in MyKinsta

If your site is hosted with Kinsta, you can restart PHP in a few clicks.

Step 1

Log into MyKinsta and click on Sites on the left. Then, click on your site from the list.

The MyKinsta dashboard

Select your site from the list at MyKinsta.
Step 2

Go to the Tools tab and click the Restart PHP button.

The Tools tab in the MyKinsta dashboard to restart PHP and resolve error 520

You can restart PHP in the MyKinsta control panel.

Cloudflare IP Addresses Aren’t Whitelisted

Another reason why the 520 error can occur is if Cloudflare’s IP addresses aren’t whitelisted. You can whitelist them, but the steps vary between hosting providers.

If you’re not sure how to whitelist IPs, contact your host, especially if you don’t find any settings for it.

At Kinsta, Cloudflare’s IP addresses are whitelisted by default so there’s no need to worry about this cause of the error. It also won’t impact the other reasons why the error occurs.

TCP Idle Timeouts Are Shorter Than 300 Seconds

The Transmission Control Protocol (TCP) could also be the cause of error 520.

TCP is a standard protocol that establishes and maintains a network connection. If the TCP is set to timeout in under 300 seconds, it could cause the 520 error to pop up.

You can change the TCP service timeout using a CLI command:

set service Service-HTTP-1 -svrTimeout 500

Headers Exceed 8 KB

This issue is typically due to too many cookies or cookies that are too large. The HAR file that you downloaded during the troubleshooting process will show you if this is the problem.

Cloudflare has a limit of 8 KB that can be used for headers.

If you authored a plugin that requires too many cookies or has too much data in its cookies, try to reduce them. Or, if you’re using a lot of plugins that all need cookies, remove some of them (you should always use quality plugins).

Elementor Users

When you try to edit your WordPress site using Elementor and you get the 520 error – “Web server is returning an unknown error” – you can check the following.

First, you can try a different web browser.

If the problem still exists and your site is behind Cloudflare you may have a problem with Cloudflare’s Rocket Loader feature.

The issue was caused by Rocket Loader automatically changing the scripts to load asynchronously, which breaks the site editor and prevents you making changes.
By creating rules in Cloudflare you can solve this issue.

For Elementor pages: Site URL/*elementor*
For Elementor templates: Site URL/?elementor_library=*

Empty Response from Your Server

This problem occurs when your site lacks an HTTP status code or response body. To resolve it, make sure your DNS settings are set correctly for your site’s domain.

The steps involved to check your settings depends on your DNS host. If your hosting plan has DNS bundled with it, then check with your hosting provider.

It may be important to note that if you updated your DNS settings, it may take up to 72 hours for your site to propagate. This means your site may be unavailable for up to three days.

After changing your DNS settings, you need to clear your site’s cache. If you have a caching plugin installed on your WordPress site, you can check its documentation if you’re unsure of how to clear your site’s cache from the plugin’s settings.

You can also clear your site’s cache through your hosting provider. Be sure to check with them if you need to know how to do this for your site.

If your site is hosted with Kinsta, you can click Sites in the menu, then on your listed site.

Then, click the Tools tab and click the Clear cache button.

The Tools tab in MyKinsta

You can clear your site’s cache using MyKinsta.

If you have updated your DNS settings, your site is available again, you cleared your site’s cache and you still are experiencing error 520, restart your server.

If you don’t find the option in your settings, contact Kinsta’s support team and we’ll help you with this.

Missing Response Headers

According to Mozilla,

“A response header is an HTTP header that can be used in an HTTP response and that doesn’t relate to the content of the message. Response headers, like Age, Location or Server are used to give a more detailed context of the response.”

Missing response headers can be caused by a multitude of reasons.

Your best bet with this issue is to use a debugging tool like Fiddler to debug the issue and see exactly what the problem is so you can fix it.

Server not Returning Proper HTTP Error Responses

When your server sent an invalid error response, it could have caused the 520 error. This means the message didn’t fit in with the standard list of HTTP response codes.

It’s caused by your server or it could also be something on your server such as PHP applications or possibly plugins used on your WordPress site.

If you can’t find the source for the improper error code to fix it, try contacting support for further help.

Enabling Cloudflare Again

Check to see if you receive the error again. If you do, keep Cloudflare disabled and continue troubleshooting.

If the 520 error has been resolved, enable Cloudflare again.

Step 1

To do this, log into Cloudflare and if you disabled Cloudflare by turning the cloud gray in your account, start by selecting your site from the list.

The Cloudflare dashboard

Select the site where you want to enable Cloudflare.

Step 2

Click the DNS tab, then click the gray cloud to re-enable Cloudflare.

The DNS tab on the Cloudflare site

Click the gray cloud to enable Cloudflare.

Restoring Cloudflare After Pausing It

Step 1

If you paused Cloudflare earlier, restore it by logging into Cloudflare and click on your listed site in the dashboard.

The Cloudflare dashboard

Select the site where you need to restore Cloudflare.

Step 2

Then, go to the Overview tab and scroll down to the bottom of the page until you see the Advanced Actions sections in the sidebar on the right-hand side of the page.

Click the Enable Cloudflare on Site link.

The Cloudflare dashboard

Click the link the enable Cloudflare again.

Turning off Development Mode

Step 1

If you have previously turned on Cloudflare’s development mode, you can turn it off by logging in. Then, click your site that’s listed on the page.

The Cloudflare dashboard

Select your site.

Step 2

Next, go to the Caching tab.

Caching tab on Cloudflare’s site

Click the Caching tab.

Step 3

Scroll down to the Development Mode section and click the toggle button that’s currently set to “On.”

The Caching Tab

Click the toggle to disable development mode.

What to Do If All Else Fails

If you’re still seeing issues, contact Cloudflare support.

Provide them with the following details:

  • Full URL(s) of the requested resource when the error occurred.
  • Cloudflare’s Ray ID from the page where you saw the error 520 message.
  • The output from http://your-site.com/cdn-cgi/trace, but be sure to replace “your-site.com” with your actual domain name.
  • Two HAR files: One from when Cloudflare was enabled for your site and one more from when you had Cloudflare disabled.

Is #Cloudflare giving you the Error 520? Here’s how to troubleshoot it and get this issue fixed! 🌧️🌈Click to Tweet

Summary

The 520 error can seem confusing, especially since it’s a Cloudflare error. But, it has to do with an error with your server that causes Cloudflare to not connect.

The steps above are the solutions to the most common causes of error 520. If you’re still having issues after trying them, you might want to contact Cloudflare or your hosting support.

Suggested reading: How to Set up Cloudflare APO for WordPress.

Ошибки 520, 521, 522, 524 могут появляться на сайте в том случае, если вы используете для своего сайта сервисы Cloudflare. Cloudflare — сервис, перенаправляющий трафик. Он позволяет увеличить скорость загрузки сайта и обеспечивает защиту от хакерских и DDoS-атак.

Ошибка 520 (Web server is returning an unknown error)

Если Cloudflare не удается обработать ответ сервера, на котором размещен сайт, то он выдает эту ошибку.

Причины появления ошибки 520

  1. Разрыв соединения, когда запрос к серверу был успешным.
  2. Превышение размера заголовка запроса (больше 8 КБ).
  3. Ответ сервера не содержит информацию.
  4. Ответ сервера некорректен.

Способы устранения ошибки 520 Web server is returning an unknown error

Если любое из вышеперечисленных условий исходит от веб-сервера, на котором размещен сайт, нужно обратиться в техподдержку хостинг-провайдера.

Правила ограничения скорости Cloudflare или другие запросы фильтрации иногда могут вызывать проблемы в работе сайта. Важно проверить и протестировать ваш сайт после подключения сервисов Cloudflare. Если на сервере хостинга используются системы безопасности, блокирующие запросы к сайту, обязательно укажите IP-адреса Cloudflare в белом списке, чтобы исключить вероятность блокировки запросов.

Список диапазонов IP-адресов Cloudflare

Ошибка 521 (Web Server Is Down)

Браузер показывает ошибку 521, когда веб-сервер неожиданно обрывает соединение с Cloudflare.

Причины появления ошибки 521

  1. Невозможно получить ответ от сервера.
  2. Система безопасности веб-сервера внесла запросы Cloudflare в черный список. Это связано с тем, что система работает по принципу обратного прокси-сервера. Ваша система безопасности могла принять периодические подключения от статических IP-адресов за DDoS-атаку. Из-за этого адреса блокируются или ограничиваются по скорости.

Способы устранения ошибки 521 Web Server Is Down

Возможно, веб-сервер отключен или работает с перебоями. В таком случае:

  1. Убедитесь, что ваш веб-сервер работает нормально.
  2. Просмотрите журналы ошибок сервера, чтобы выявить причину ошибки.

Если веб-сервер или хостинг-провайдер блокируют запросы Cloudflare, внесите в белый список все диапазоны IP-адресов сервиса в брандмауэре сервера или другом программном обеспечении безопасности.

Ошибка 522 (Connection timed out)

Появляется в случае, когда превышено время ожидания ответа от веб-сервера.

Причины появления ошибки 522

  1. Веб-сервер не может ответить на запрос из-за высокой загруженности.
  2. Система защиты веб-сервера блокирует запросы Cloudflare.
  3. Нет доступа к веб-серверу.
  4. Некорректно указаны настройки DNS на Cloudflare: запросы отправляются по другому адресу.

  5. Неверная настройка маршрутизации между Cloudflare и веб-сервером.

Способы устранения ошибки 522 Connection timed out

Убедитесь, что:

  1. IP-адреса Cloudflare не блокируются в брандмауэре.
  2. Ваш хостинг-провайдер не ограничивает скорость и не блокирует запросы от Cloudflare.
  3. Веб-сервер не перегружен.

Неисправную маршрутизацию в сети между Cloudflare и исходным веб-сервером устранить сложнее. Прежде чем перейти к этому пункту, исключите предыдущие. Если вы считаете, что причиной могут быть проблемы с сетью, отправьте заявку в службу поддержки Cloudflare.

Ошибка 524 (A timeout occurred)

Браузер покажет эту страницу, когда подключение к веб-серверу будет установлено, но его ответ превысит лимит ожидания. Cloudflare ожидает HTTP-ответ в течение 100 секунд.

Причины появления ошибки 524

  1. Проблемы в работе PHP-скриптов или сбой базы данных.
  2. Высокая загруженность веб-сервера.

Способы устранения ошибки 524 A timeout occurred

Проверьте доступные ресурсы веб-сервера, включая процессор, оперативную память и общий уровень трафика. Высокий уровень использования памяти память или высокая загрузка процессора могут сигнализировать о проблеме с ресурсами.

Если вы регулярно отправляете HTTP-запросы, выполнение которых занимает более 100 секунд (например, экспорт больших данных), рассмотрите возможность перемещения этих длительных процессов в поддомен, который не проксируется Cloudflare.

Служба поддержки RU-CENTER не оказывает техническую поддержку по сервису Cloudflare. Для устранения ошибок, пожалуйста, обратитесь в техническую поддержку Cloudflare. Если неполадки в работе сайта связаны с хостингом RU-CENTER, пожалуйста, отправьте заявку в нашу службу технической поддержки.

  Туториал: как исправить ошибки сервера

Ошибки 520, 521, 522, 524 связаны с проблемами в работе сервиса CloudFlare.

CloudFlare — сервис для перенаправления трафика на сайт с помощью облачного прокси-сервера, который обеспечивает дополнительную защиту от DDoS-атак и ускоряет загрузку вашего сайта.

Ошибка 520 Unknown Error

Что означает ошибка 520? Система CloudFlare выдаёт 520 ошибку, если не может обработать ответ от веб-сервера, на котором расположен сайт:

Причины появления ошибки:

  • сброс соединения (после успешного запроса сервер разорвал соединение);
  • заголовок запроса превышает ограничение размера заголовка Cloudflare (более 8 КБ). Если у вас много файлов cookie или они очень большие, это может привести к увеличению размера заголовков. Так как у Cloudflare есть ограничение на размер заголовка в 8 КБ, он не может обработать длинный заголовок;
  • пустой ответ от сервера. Это происходит, когда DNS домена указывают на неправильный сервер.
  • некорректный ответ от сервера;
  • система безопасности блокирует запросы. Укажите IP-адреса Cloudflare в белом списке, чтобы система не блокировала запросы.

Способы устранения ошибки:

  1. Отключить CloudFlare. Так вы сможете понять, где находится ошибка (на сервере или в CloudFlare).
  2. Удалить плагины. Для плагинов иногда требуется много файлов cookies. Если на сайте много плагинов, это может повлиять на размер заголовков. Они могут быть слишком большими по размеру, и Cloudflare не справится с ними. Чтобы исправить ошибку, отключите плагины один за другим. Если ошибка пропадёт, удалите некоторые из плагинов.
  3. Проверьте настройки DNS в CloudFlare. Убедитесь, что запись A указывает на правильный IP-адрес.

Подробные рекомендации по исправлению ошибки 520 даны в справке CloudFlare.

Ошибка 521 Web Server Is Down

Код ошибки 521 возникает, когда веб-сервер обрывает соединение с CloudFlare:

Это может произойти в двух случаях:

  • сервер не отвечает или недоступен. Необходимо проверить работоспособность сервера;
  • веб-сервер блокирует запросы CloudFlare. Поскольку CloudFlare работает как обратный прокси-сервер, все запросы к серверам поступают от IP-адресов CloudFlare. Иногда система безопасности хостинга принимает постоянные подключения с одних и тех же IP-адресов за DDoS-атаку. В результате на IP-адреса CloudFlare накладывается блокировка/ограничения по скорости.

Диапазон IP-адресов CloudFlare вы можете увидеть по ссылке.

Рекомендации по исправлению ошибки 521 даны в справке CloudFlare.

Ошибка 522 Connection timed out

Ошибка 522 возникает, если превышено время ожидания ответа от веб-сервера и пользователь не может попасть на страницу:

Основные причины:

  • веб-сервер перегружен и не ответил на запрос,
  • на веб-сервере стоит система защиты, которая блокирует запросы от CloudFlare,
  • веб-сервер недоступен,
  • некорректный IP-адрес, установленный в настройках DNS на CloudFlare (Запрос от CloudFlare был отправлен на другой IP),
  • проблемы с маршрутизацией сети между CloudFlare и веб-сервером.

Что делать? Для решения проблемы удостоверьтесь, что ваш веб-сервер активен и принимает HTTP-запросы. Проверьте, корректны ли настройки DNS в Личном кабинете на CloudFlare.

Подробные рекомендации по исправлению ошибки 522 даны в справке CloudFlare.

Как исправить ошибку 522 в Google Chrome

Методы решения:

  1. Очистите кеш браузера. Браузер может быть переполнен данными о посещении сайтов. Освободите место в кэше браузера по инструкции.
  2. Удалите расширение браузера, которое нарушает соединение с сервером. Отключайте расширения по очереди, чтобы найти то, которое выдает ошибку.
  3. Проверьте подключение к интернету. Низкая скорость интернета или перебои при подключении может повлиять на время получения ответа сервера. Из-за этого и появляется ошибка 522.


Как проверить подключение к интернету

  1. 1.

    Откройте командную строку. Для этого введите в поисковую строку «Командная строка» и выберите появившееся приложение:

  2. 2.

    Введите в командной строке:

Готово, вы получите сообщение с количеством переданных и полученных пакетов. Если потерянных пакетов нет, значит, у вас хорошее соединение с интернетом и проблема в другом. Если потерянные пакеты есть, свяжитесь с интернет-провайдером, чтобы улучшить интернет-соединение.

4. Очистите кеш DNS. Проблемы с соединением могут возникнуть из-за несоответствия IP-адреса сервера сайта в кэше компьютера с реальным адресом. Такое происходит, когда владельцы сайтов по какой-либо причине меняют IP-адреса сервера. Чтобы устранить эту проблему, воспользуйтесь инструкцией.

Ошибка 524 A timeout occurred

Ошибка 524 возникает, когда подключение с веб-сервером установлено, но он не ответил за установленное время ожидания соединения:

Время ожидания HTTP-ответа на CloudFlare — 100 секунд. Если веб-сервер не предоставил ответ, система выдаст 524 ошибку.

Основные причины:

  • длительная работа PHP-процесса или запроса к базе данных;
  • веб-сервер перегружен. Проверьте доступные ресурсы сервера, в том числе процессор и оперативную память.

Если вы регулярно выполняете тяжёлые запросы, которые могут занять больше 100 секунд, переместите эти процессы на субдомен, который не проксимируется в Cloudflare.

Рекомендации по исправлению ошибки 524 даны в справке CloudFlare.

Техническая поддержка

Специалисты REG.RU не оказывают техническую поддержку по сервису CloudFlare. Для устранения ошибки обратитесь в техническую поддержку CloudFlare. Если некорректная работа сайта связана с хостингом REG.RU, напишите заявку в службу технической поддержки.

Ошибки 520-524 требуют много знаний о сервере и его работе, поэтому самый верный способ решить проблему ― обратиться к хостинг-провайдеру, администратору сайта или к технической поддержке CloudFlare (если проблема на стороне их сервиса).

Error analytics

Error Analytics per domain are available within Zone Analytics. Error Analytics allows insight into overall errors by HTTP error code and provides the URLs, source IP addresses, and Cloudflare data centers needed to diagnose and resolve the issue.  Error Analytics are based on a 1% traffic sample.

To view Error Analytics:

  • Log in to the Cloudflare dashboard.
  • Click the appropriate Cloudflare account for your site, then pick the domain.
  • Next, click the Analytics & Logs app icon.
  • Click Add filter, select Edge status code or Origin status code and choose any 5xx error code that you want to diagnose.

Error 500: internal server error

Error 500 generally indicates an issue with your origin web server.  Error establishing database connection is a common HTTP 500 error message generated by your origin web server.  Contact your hosting provider to resolve.

Resolution

Provide details to your hosting provider to assist troubleshooting the issue.

However, if the 500 error contains “cloudflare” or “cloudflare-nginx” in the HTML response body, provide 
Cloudflare support with the following information:

  1. Your domain name
  2. The time and timezone of the 500 error occurrence
  3. The output of www.example.com/cdn-cgi/trace from the browser where the 500 error was observed (replace www.example.com with your actual domain and host name)

Error 502 bad gateway or error 504 gateway timeout

An HTTP 502 or 504 error occurs when Cloudflare is unable to establish contact with your origin web server.

There are two possible causes:

  • (Most common cause) 502/504 from your origin web server
  • 502/504 from Cloudflare

502/504 from your origin web server

Cloudflare returns an Cloudflare-branded HTTP 502 or 504 error when your origin web server responds with a standard HTTP 502 bad gateway or 504 gateway timeout error:

Example of a Cloudflare-branded error 502.

Resolution

Contact your hosting provider to troubleshoot these common causes at your origin web server:

  • Ensure the origin server responds to requests for the hostname and domain within the visitor’s URL that generated the 502 or 504 error.
  • Investigate excessive server loads, crashes, or network failures.
  • Identify applications or services that timed out or were blocked.

502/504 from Cloudflare

A 502 or 504 error originating from Cloudflare appears as follows:

Example of an unbranded error 502.

If the error does not mention “cloudflare,” contact your hosting provider for assistance on 502/504 errors from your origin.

Resolution

To avoid delays processing your inquiry, provide these required details to 
Cloudflare Support:

  1. Time and timezone the issue occurred.
  2. URL that resulted in the HTTP 502 or 504 response (for example: 
    https://www.example.com/images/icons/image1.png
    )
  3. Output from browsing to 
    www.example.com/cdn-cgi/trace
     (replace 
    www.example.com
     with the domain and host name that caused the HTTP 502 or 504 error)

Error 503: service temporarily unavailable

HTTP error 503 occurs when your origin web server is overloaded. There are two possible causes discernible by error message:

  • Error doesn’t contain “cloudflare” or “cloudflare-nginx” in the HTML response body.

Resolution: Contact your hosting provider to verify if they rate limit requests to your origin web server.

  • Error contains “cloudflare” or “cloudflare-nginx” in the HTML response body.

Resolution: A connectivity issue occured in a Cloudflare data center. Provide 
Cloudflare support with the following information:

  1. Your domain name
  2. The time and timezone of the 503 error occurrence
  3. The output of 
    www.example.com/cdn-cgi/trace
     from the browser where the 503 error was observed (replace 
    www.example.com
     with your actual domain and host name)

Error 520: web server returns an unknown error

Error 520 occurs when the origin server returns an empty, unknown, or unexpected response to Cloudflare.

Resolution

Contact your hosting provider or site administrator and request a review of your origin web server error logs for crashes and to check for these common causes:

  • Origin web server application crashes
  • Cloudflare IPs not allowed at your origin
  • Headers exceeding 16 KB (typically due to too many cookies)
  • An empty response from the origin web server that lacks an HTTP status code or response body
  • Missing response headers or origin web server not returning 
    proper HTTP error responses.

    • upstream prematurely closed connection while reading response header from upstream is a common error we may notice in our logs. This indicates the origin web server was having issues which caused Cloudflare to generate 520 errors.

If 520 errors continue after contacting your hosting provider or site administrator, provide the following information to 
Cloudflare Support:

  • Full URL(s) of the resource requested when the error occurred
  • Cloudflare cf-ray from the 520 error message
  • Output from 
    http://www.example.com/cdn-cgi/trace
     (replace 
    www.example.com
     with your hostname and domain where the 520 error occurred)
  • Two 
    HAR files:

    • one with Cloudflare enabled on your website, and
    • the other with 
      Cloudflare temporarily disabled.

Error 521: web server is down

Error 521 occurs when the origin web server refuses connections from Cloudflare. Security solutions at your origin may block legitimate connections from certain 
Cloudflare IP addresses.

The two most common causes of 521 errors are:

  • Offlined origin web server application
  • Blocked Cloudflare requests

Resolution

Contact your site administrator or hosting provider to eliminate these common causes:

  • Ensure your origin web server is responsive
  • Review origin web server error logs to identify web server application crashes or outages.
  • Confirm 
    Cloudflare IP addresses are not blocked or rate limited
  • Allow all 
    Cloudflare IP ranges in your origin web server’s firewall or other security software
  • Confirm that — if you have your SSL/TLS mode set to Full or Full (Strict) — you have installed a Cloudflare Origin Certificate
  • Find additional troubleshooting information on the 
    Cloudflare Community.

Error 522: connection timed out

Error 522 occurs when Cloudflare times out contacting the origin web server. Two different timeouts cause HTTP error 522 depending on when they occur between Cloudflare and the origin web server:

  1. Before a connection is established, the origin web server does not return a SYN+ACK to Cloudflare within 15 seconds of Cloudflare sending a SYN.
  2. After a connection is established, the origin web server doesn’t acknowledge (ACK) Cloudflare’s resource request within 90 seconds.

Resolution

Contact your hosting provider to check the following common causes at your origin web server:

  • (Most common cause) 
    Cloudflare IP addresses are rate limited or blocked in .htaccess, iptables, or firewalls. Confirm your hosting provider allows Cloudflare IP addresses.
  • An overloaded or offline origin web server drops incoming requests.
  • Keepalives are disabled at the origin web server.
  • The origin IP address in your Cloudflare DNS app does not match the IP address currently provisioned to your origin web server by your hosting provider.
  • Packets were dropped at your origin web server.

If you are using Cloudflare Pages, verify that you have a custom domain set up and that your CNAME record is pointed to your custom Pages domain. Instructions on how to set up a custom Pages domain can be found here.

If none of the above leads to a resolution, request the following information from your hosting provider or site administrator before 
contacting Cloudflare support:

  • An 
    MTR or traceroute from your origin web server to a 
    Cloudflare IP address that most commonly connected to your origin web server before the issue occurred. Identify a connecting Cloudflare IP recorded in the origin web server logs.
  • Details from the hosting provider’s investigation such as pertinent logs or conversations with the hosting provider.

Error 523: origin is unreachable

Error 523 occurs when Cloudflare cannot contact your origin web server. This typically occurs when a network device between Cloudflare and the origin web server doesn’t have a route to the origin’s IP address.

Resolution Contact your hosting provider to exclude the following common causes at your origin web server:

  • Confirm the correct origin IP address is listed for A or AAAA records within your Cloudflare DNS app.
  • Troubleshoot Internet routing issues between your origin and Cloudflare, or with the origin itself.

If none of the above leads to a resolution, request the following information from your hosting provider or site administrator:

  • An 
    MTR or traceroute from your origin web server to a 
    Cloudflare IP address that most commonly connected to your origin web server before the issue occurred. Identify a connecting Cloudflare IP from the logs of the origin web server.
  • If you use Railgun (deprecated) via a Cloudflare Hosting Partner, contact your hosting provider to troubleshoot the 523 errors.
  • If you manage your Railgun (deprecated) installation, provide the following:

    • traceroute to your origin web server from your Railgun server.
    • The most recent syslog file from your Railgun server.

Error 524: a timeout occurred

Error 524 indicates that Cloudflare successfully connected to the origin web server, but the origin did not provide an HTTP response before the default 100 second connection timed out. This can happen if the origin server is simply taking too long because it has too much work to do — e.g. a large data query, or because the server is struggling for resources and cannot return any data in time.

Resolution

Here are the options we’d suggest to work around this issue:

  • Implement status polling of large HTTP processes to avoid hitting this error.
  • Contact your hosting provider to exclude the following common causes at your origin web server:
    • A long-running process on the origin web server.
    • An overloaded origin web server.
  • Enterprise customers can increase the 524 timeout up to 6000 seconds using the proxy_read_timeout API endpoint.
  • If you regularly run HTTP requests that take over 100 seconds to complete (for example large data exports), move those processes behind a subdomain not proxied (grey clouded) in the Cloudflare DNS app.
  • If error 524 occurs for a domain using Cloudflare Railgun (deprecated), ensure the lan.timeout is set higher than the default of 30 seconds and restart the railgun service.

Error 525: SSL handshake failed

525 errors indicate that the SSL handshake between Cloudflare and the origin web server failed. Error 525 occurs when these two conditions are true:

  1. The 
    SSL handshake fails between Cloudflare and the origin web server, and
  2. Full or Full (Strict) SSL is set in the Overview tab of your Cloudflare SSL/TLS app.

Resolution

Contact your hosting provider to exclude the following common causes at your origin web server:

  • No valid SSL certificate installed
  • Port 443 (or other custom secure port) is not open
  • No 
    SNI support
  • The cipher suites accepted by Cloudflare does not match the cipher suites supported by the origin web server

Additional checks

  • Check if you have a certificate installed on your origin server. You can check this article for more details on how to run some tests. In case you don’t have any certificate, you can create and install our free Cloudflare origin CA certificate. Using Origin CA certificates allows you to encrypt traffic between Cloudflare and your origin web server.
  • Review the cipher suites your server is using to ensure they match what is supported by Cloudflare.
  • Check your server’s error logs from the timestamps you see 525s to ensure there are errors that could be causing the connection to be reset during the SSL handshake.

Error 526: invalid SSL certificate

Error 526 occurs when these two conditions are true:

  1. Cloudflare cannot validate the SSL certificate at your origin web server, and
  2. Full SSL (Strict) SSL is set in the Overview tab of your Cloudflare SSL/TLS app.

Resolution

Request your server administrator or hosting provider to review the origin web server’s SSL certificates and verify that:

  • Certificate is not expired
  • Certificate is not revoked
  • Certificate is signed by a 
    Certificate Authority (not self-signed)
  • The requested or target domain name and hostname are in the certificate’s Common Name or Subject Alternative Name
  • Your origin web server accepts connections over port SSL port 443
  • Temporarily pause Cloudflare and visit 
    https://www.sslshopper.com/ssl-checker.html#hostname=www.example.com (replace www.example.com with your hostname and domain) to verify no issues exists with the origin SSL certificate:

Screen showing an SSL certificate with no errors.

If the origin server uses a self-signed certificate, configure the domain to use Full SSL instead of Full SSL (Strict). Refer to recommended SSL settings for your origin.


527 Error: Railgun Listener to origin error

A 527 error indicates an interrupted connection between Cloudflare and your origin’s 
Railgun server (rg-listener). Common causes include:

  • Firewall interference
  • Network incidents or packet loss between the Railgun server and Cloudflare

Common causes of 527 errors include:

  • Connection timeouts
  • LAN timeout exceeded
  • Connection refusals
  • TLS/SSL related errors

If contacting Cloudflare support, provide the following information from the Railgun Listener:

  • The full content of the railgun.conf file
  • The full content of the railgun-nat.conf file
  • Railgun log files that detail the observed errors

Connection timeouts

The following Railgun log errors indicate a connection failure between the Railgun Listener and your origin web server:

connection failed 0.0.0.0:443/example.com: dial tcp 0.0.0.0:443: i/o timeout

no response from origin (timeout) 0.0.0.0:80/example.com

Resolution

Contact your hosting provider for assistance to test for connectivity issues between your origin web server and your Railgun Listener. For example, a netcat command tests connectivity when run from the Railgun Listener to the origin web server’s SERVERIP and PORT (80 for HTTP or 443 for HTTPS):

LAN timeout exceeded

The following Railgun Listener log error is generated if the origin web server does not send an HTTP response to the Railgun Listener within the 30 second default timeout:

connection failed 0.0.0.0:443/example.com: dial tcp 0.0.0.0:443: i/o timeout

The time is adjusted by the lan.timeout parameter of the railgun.conf file.

Resolution

Either increase the lan.timeout limit in railgun.conf, or review the web server configuration. Contact your hosting provider to confirm if the origin web server is overloaded.

Connection refusals

The following errors appear in the Railgun logs when requests from the Railgun Listener are refused:

Error getting page: dial tcp 0.0.0.0:80:connection refused

Resolution

Allow the IP of your Railgun Listener at your origin web server’s firewall.

The following errors appear in the Railgun logs if TLS connections fail:

connection failed 0.0.0.0:443/example.com: remote error: handshake failure

connection failed 0.0.0.0:443/example.com: dial tcp 0.0.0.0:443:connection refused

connection failed 127.0.0.1:443/www.example.com: x509: certificate is valid for

example.com, not www.example.com

Resolution

If TLS/SSL errors occur, check the following on the origin web server and ensure that:

  • Port 443 is open
  • An SSL certificate is presented by the origin web server
  • the SAN or Common Name of the origin web server’s SSL certificate contains the requested or target hostname
  • SSL is set to Full or Full (Strict) in the Overview tab of the Cloudflare SSL/TLS app

Error 530

HTTP error 530 is returned with an accompanying 1XXX error displayed. Search for the specific 
1XXX error within the Cloudflare Help Center for troubleshooting information.


  • Gathering information to troubleshoot site issues
  • Contacting Cloudflare Support
  • Customizing Cloudflare error pages
  • MTR/Traceroute Diagnosis and Usage
  • Cloudflare Community Tips

Introduction

Cloudflare’s error 520 is a complex error code indicating that a webpage cannot be reached. The complexity of the issue lies in the variety of reasons that could have caused it.

Becoming familiar with potential causes is the key to streamlining the troubleshooting process.

This article explains what the error means, why it occurs, and how to troubleshoot and resolve it.

How to fix Error 520

Error 520 is a Cloudflare error message indicating that the origin web server received an invalid or incorrectly interpreted request, resulting in an empty response. 

What Causes Error 520?

The most common causes for error 520 are:

  • PHP applications crashing.
  • Incorrectly configured DNS records.
  • Corrupt or incorrectly configured .htaccess file.
  • Large request headers and excessive cookie usage.
  • Missing request headers.
  • Empty response from server.

How to Troubleshoot and Fix Error 520

The following steps outline the process of investigating the cause behind Cloudflare’s error 520, so appropriate action can be taken accordingly.

Note: Before attempting the following methods, check that the affected website is completely inaccessible and that Cloudflare’s system status is “All Systems Operational”.

1. Pause Cloudflare

If the issue lies in Cloudflare, pausing it will make the page affected by the error accessible again. 

To pause Cloudflare: 

  1. Log in to your Cloudflare account. 
  2. Navigate to the Overview tab in the left-hand panel.
  3. Scroll down to the Advanced Actions section and select Pause Cloudflare on Site

How to pause Cloudflare to troubleshoot error 520.

2. Check DNS Records

Domain Name System (DNS) records are files in authoritative DNS servers that specify: 

  • What IP address is associated with a domain. 
  • How to handle incoming requests for that domain. 

For Cloudflare to work properly, Cloudflare DNS records must match the ones in the domain’s DNS management system. 

To locate Cloudflare’s DNS records for a website: 

  1. Log in to Cloudflare.
  2. Select the website that outputs the error 520.
  3. In the left-hand menu, select DNS > Records.

How to locate Cloudflare DNS records.

The exact steps to access a domain’s DNS settings depend on the website’s hosting platform. 

3. Restart PHP

Error 520 occurs also when a PHP application crashes. In that case, restarting the web server hosting the website fixes the issue. 

Depending on your software stack, PHP can be restarted in several ways. Below are instructions on how to restart an Apache or Nginx server on different operating systems.

Apache Web Server

To restart an Apache server running on an Ubuntu or Debian system, run:

sudo systemctl restart apache2

To restart an Apache server running on a CentOS 7 system, run:

sudo apachectl -k restart

Nginx Web Server

To restart an Nginx server gracefully, run:

sudo systemctl reload nginx

To force restart an Nginx server, run:

sudo systemctl restart nginx

Alternatively, to force close and restart Nginx and related processes, use:

sudo /etc/init.d/nginx restart

Some hosting platforms allow users to restart PHP using a graphical user interface (GUI). In that case, consult the hosting platform’s user manual or contact the customer support department. 

4. Check Headers and Cookies

The maximum allowed size of Cloudflare’s request headers is 32 KB, 16 KB per individual header. Exceeding these thresholds may cause the 520 error to occur. 

Information regarding the request headers’ size is available in the origin server’s HAR (HTTP Archive) file. 

To generate and extract a HAR file using Google Chrome:

  1. Open the web page displaying the 520 error.
  2. Right-click and select Inspect.

Inspect page to generate HAR file.

  1. Select the Network tab.
  2. Check the Preserve log option.
  3. Click the Clear (stop sign) button.

Setting up the Google Chrome browser to generate a HAR file

  1. Reload the page.
  2. Right-click anywhere in the area below the nav bars of the inspect tool.
  3. Select Save all as HAR with content.

How to save a HAR file.

The process of generating a HAR file is almost identical between different major web browsers since they are all built upon Chromium (except Firefox).

Examining HAR files is only possible with software like Google’s HAR Analyzer. 

Important: HAR files contain sensitive information, such as cookies, passwords, and other types of personal data. Remove any compromising data before sharing HAR files with anyone.

The anomaly to look for in HAR files is cookies that are too large and the overall excessive use of cookies.

To reduce cookie size and lighten the request header load:

  • Remove unnecessary third-party plugins from the website.
  • Limit request overhead.
  • Use a cookie-free domain.

5. Disable .htaccess

The .htaccess file affects the global configuration of an Apache server without changing the configuration files.

Error 520 can appear when a redirect was not configured properly in the .htaccess file, or the file itself is corrupted. Disabling the .htaccess file will reveal whether the file is problematic.

1. To disable the .htaccess file, start by opening the apache2.conf file in a text editor (we are using nano):

sudo nano /etc/apache2/apache2.conf

The default location for the Apache config file is one of the following:

  • /etc/httpd/httpd.conf
  • /etc/apache2/httpd.conf
  • /etc/apache2/apache2.conf
  • /etc/httpd/conf/httpd.conf

2. Find the value of the AllowOverride directive and change it to None.

<Directory /var/www/html>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Require all granted
</Directory>

3. Save and close the file.

4. To apply the changes, restart Apache:

sudo systemctl apache2 restart

6. Check Web Server Error Logs

Error logs provide additional information about where, why, and what error occurred. 

The process of locating or generating error logs varies between hosting providers. However, all error logs feature a similar structure and will provide the following information:

  • The date and time of the incident.
  • The IP address of the client (if the client caused the error to happen).
  • An error message.
  • A path to the affected resource or the line of code causing the issue.

7. Check HTTP Error Response with a cURL Command

Client URL (cURL) commands allow users to get information about the HTTP error response code and request headers.

The general syntax is:

sudo curl -svo /dev/null https://yourwebsitehere.com

A successful response will look like the following example:

*   Trying 111.11.1.111...
* Connected to 111.11.1.111 (111.11.1.111) port 100 (#0)
> GET /login HTTP/1.1
> User-Agent: YourBrowser 1.0
> Accept: */*
> Host: examplewebsite.com
>
< HTTP/1.1 200 OK
< Content-Type: text/html
< Date: Day, DD, Month Year Hour:Minute:Second Timezone
{ [11111 bytes data]
* Connection #0 to host 111.11.1.111 left intact

However, the command will not be able to retrieve information if the 520 error has occurred, and the result will look similar to the following example:

*   Trying 111.11.1.111...
* Connected to 111.11.1.111 (111.11.1.111) port 100 (#0)
> GET /login HTTP/1.1
> User-Agent: YourBrowser 1.0
> Accept: */*
> Host: examplewebsite.com
>
* Empty reply from server
* Connection #0 to host 111.11.1.111 left intact

8. Contact Cloudflare Support

If none of the previous methods helped locate the source of the issue, contacting Cloudflare support is the next step.

Cloudflare offers two support methods:

  • Support tickets – available to all accounts and accessible via the admin dashboard.
  • Live chat – available to Business and Enterprise accounts only.

In both cases, representatives will request the following information:

  • URL(s) of the affected resource(s)
  • Cloudflare’s Ray ID from the affected resource(s)
  • The result of entering the following URL in a browser http://example.com/cdn-cgi/trace (replace example.com with the right domain)
  • A HAR file from when Cloudflare was enabled on the website
  • A HAR file from when Cloudflare was disabled on the website

Conclusion

Discovering and resolving errors quickly is paramount to reducing downtimes and ensuring positive user experiences.

Use the information in this guide to prevent, troubleshoot, and resolve 520 errors.

Besides error 520, websites using Cloudflare’s CDN can display a variety of other error messages, a common one being 521: Web server is down. Read our guide to find out what error 521 or 526 Invalid SSL Certificate error means and how to troubleshoot and fix it.

Возможно, вам также будет интересно:

  • 52 ошибка тойота левин
  • 52 ошибка тойота 3vz
  • 52 ошибка сканера hp m521 что делать
  • 52 ошибка сканера hp 1522nf
  • 52 ошибка мотора сканера hp

  • Понравилась статья? Поделить с друзьями:
    0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии