Неизвестная ошибка http 429

Как владелец веб-сайта вы время от времени сталкиваетесь с сообщением об ошибке. Некоторые из этих ошибок будет относительно просто исправить, а другие – сложно. Возьмем, к примеру, ошибку HTTP 429.

Что означает ошибка HTTP 429 и как ее исправить

Источник изображения

Устранение этой ошибки затруднено, поскольку она содержит мало подробностей. Вы знаете, что что-то не так, и вам нужно это исправить, но вы не совсем уверены, что произошло и почему.

Чтобы убедиться, что вы понимаете и можете решить эту проблему, мы рассмотрим, что означает ошибка 429 и каковы ее наиболее распространенные решения.

Что такое ошибка HTTP 429?

Ошибка HTTP 429 – это код состояния ответа HTTP, который указывает, что клиентское приложение превысило предел скорости или количество запросов, которые они могут отправить за определенный период времени. Обычно этот код не просто сообщает клиенту о прекращении отправки запросов – он также указывает, когда они могут отправить другой запрос.

Ответ 429 технически не является ошибкой – это ответ сервера, интерфейса прикладного программирования (API) или плагина, который сообщает клиентскому приложению о прекращении отправки запросов, потому что у них просто недостаточно ресурсов для его приема в это время. Клиентское приложение обычно относится к веб-сайту или приложению, но также может относиться к отдельным пользователям, таким как администратор сайта, посетитель сайта или хакер.

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

Хотя ответ 429 может показаться карательным, на самом деле это защитная мера от пользователей, намеренно или случайно злоупотребляющих ресурсами сервера (или API, плагина или другой службы). Он разработан для предотвращения резервного копирования или переполнения запросов, которые могут перегрузить сервер или другую службу, которая предназначена для совместного использования и использования многими веб-сайтами и приложениями. Таким образом, контролируя количество и время запросов, ограничения скорости предотвращают проблемы до их возникновения.

Если вы видите ошибку HTTP 429 на своем сайте по другим причинам, вам может потребоваться уменьшить количество запросов к серверу или вызовов API, которые вы делаете. Обсуждаемые ниже шаги являются общими исправлениями ошибки 429 Too Many Requests. Если у вас есть сайт WordPress, вам могут потребоваться специальные решения для WordPress.

Как исправить ошибку HTTP 429

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

Большинство приведенных ниже шагов направлены на предотвращение, а не на исправление ошибки HTTP 429 задним числом. Взглянуть.

1 Дождитесь отправки другого запроса.

Самый простой способ исправить ошибку HTTP 429 – дождаться отправки другого запроса. Часто этот код состояния отправляется с заголовком «Retry-after», который указывает период времени ожидания перед отправкой другого запроса. Он может указывать всего несколько секунд или минут.

Вот пример, который просит клиента подождать час перед отправкой другого запроса.

HTTP/1.1 429 Too Many Requests
Content-Type: text/html
Retry-After: 3600
<html>
  <head>
    <title>Too Many Requests</title>
  </head>
  <body>
    <h1>Too Many Requests</h1>
    <p>Only 100 requests per hour per logged in user is allowed on this website. Try again soon.</p>
  </body>
</html>

2 Реализуйте экспоненциальный откат.

Если заголовок «Retry-after» не отправляется, и вы не знаете, сколько времени ждать перед попыткой, вам следует реализовать повторные попытки с экспоненциальным откатом. Используя этот подход, ваше приложение не будет немедленно повторять неудавшийся запрос; вместо этого он выполнит серию повторных попыток с постепенно увеличивающимся временем ожидания между каждой попыткой. Когда запрос будет окончательно принят, вы узнаете, какое время или скорость ожидания приемлемы.

Вы можете добавить код для реализации этого подхода или использовать такой инструмент, как Celery, который имеет встроенную функцию экспоненциальной задержки.

Что означает ошибка HTTP 429 и как ее исправить

Источник изображения

3 Установите свой собственный предел дросселирования.

Регулирование – это процесс ограничения количества запросов, которые приложение может отправить за определенный промежуток времени. Если этот предел превышен, запросы к серверу или API обычно отбрасываются или выполняются с кэшированными данными.

Хотя этот подход чаще всего используется сторонними API или платформами для предотвращения превышения клиентскими приложениями своих ограничений, он также может быть полезен для ограничения вашего собственного потребления сторонних API или ресурсов сервера. Фактически, вы можете установить более строгий лимит регулирования для себя, чтобы предотвратить выход за пределы сервера, API или другой службы, которую вы используете. Это особенно хорошая идея, если вы используете дорогостоящий API, например Twitter API, и не хотите выходить за рамки своей политики использования.

4 Свяжитесь с вашим хостинг-провайдером.

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

Если вы попробовали описанные выше действия и по-прежнему видите ошибку 429, возможно, причина возникла на вашем сервере, а не на вашем веб-сайте. Также возможно, что ваш хост блокирует запросы от определенных сторонних сервисов или платформ, таких как Google Search Console, которая делает множество запросов к веб-сайтам. Обратившись к вашему провайдеру, он может решить проблему или предоставить ценную информацию.

Устранение ошибки HTTP 429

Ошибка HTTP 429 является распространенным явлением, но ее можно избежать, если обратить внимание на ограничения скорости, установленные вашим сервером, API, плагином или другими. Если вы превысите эти ограничения, вы можете предпринять шаги для устранения ошибки 429. Поступая таким образом, вы продолжите предоставлять посетителям удобство работы с вашим сайтом.

Источник записи: https://blog.hubspot.com

При взаимодействии с веб-ресурсами можно столкнуться с различными проблемами. Одна их таких проблем – ошибка с кодом 429 Too Many Requests. Существует две самые распространенные причины возникновения этой ошибки сервера, с которыми нам предстоит разобраться самостоятельно. 

Причины появления ошибки сервера 429

DDoS-атаки

Начать следует с того, что чаще всего ошибка 429 сопровождается надписью «The user has sent too many requests in a given amount of time», что означает превышение ограничений по запросам к сайту. Соответственно, именно так происходит предотвращение DDoS-атак, которые и являются основной причиной появления рассматриваемой проблемы. Помимо самого кода, вы увидите и несколько других параметров:

  1. Общее количество запросов.

  2. Запросы с конкретного IP-адреса в секунду.

  3. Количество одновременных запросов.

  4. Общее количество запросов с одного IP-адреса.

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

В случае, когда есть уверенность в том, что ошибка http 429 появилась именно из-за атак на ваш ресурс, советую ознакомиться с отдельным материалом, в котором вы узнаете, как обезопасить себя от DDoS эффективными инструментами и банальными мерами предосторожности.

Подробнее: Способы защиты от DDoS-атаки

Некорректная работа плагинов WordPress

Вторая распространенная причина, которая может быть связана с регулярным появлением неполадки 429, – некорректное функционирование плагинов под управлением CMS WordPress. Для решения этой проблемы потребуется выполнить несколько несложных действий. 

Для начала по очереди отключайте каждый установленный скрипт через меню управления этими компонентами. Параллельно проверяйте, появляется ли ошибка. Да, на выполнение этой задачи может уйти много времени, однако это самый эффективный метод выявления плагина, который является триггером. Отметим, что сразу несколько компонентов могут вызывать проблему, поэтому постарайтесь проверить их все.

Отключение плагинов ВордпрессЧто касается использования плагинов, то тут всегда лучше подключать только проверенные и качественные решения. Со списком таких плагинов предлагаю ознакомиться в материале по следующей ссылке.

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

Действия со стороны обычного пользователя

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

Страница недоступна, ошибка 429

Ошибка HTTP с кодом 429 – неприятная ситуация, которая может коснуться каждого владельца сайта. Из приведенного выше материала вы поняли, что существует две основные причины, которые могут ее вызывать. Теперь остается только разобраться с каждой из них и провести проверочные работы, чтобы оперативно исправить сложившуюся ситуацию.

If you own a website or frequently browse the internet, you may have come across the HTTP 429 Too Many Requests error. This error occurs when a server detects that a client has exceeded the rate limits or has made too many requests in a given period of time.

It is a client-side error, meaning that it is caused by actions taken by the user or client and not by the server hosting the website.

In this article, we will discuss what HTTP 429 is, what causes the HTTP 429 Too Many Requests error, provide examples of the error message, and offer 11 proven solutions to fix it.

What Is the Error 429 Too Many Requests?

HTTP error 429 technically is not an error but is an application-level response that a server is sending to a client (browser) which exceeds the limit of requests for a specified period of time

The error code HTTP 429 Too Many Requests is one of the many 4.x.x HTTP status codes that indicate errors from the client side and not the server.

It’s typical for web servers to set a limit of possible HTTP requests for a given time frame. They impose this security measure to prevent overload and downtime. The error usually occurs when a client sends too many requests and hits that limit. As a result, the server stops the connection and sends the HTTP 429 response to the client.

Depending on which browser you are using, different variations of the error message may appear:

  • 429 Too Many Requests
  • 429 Error
  • HTTP 429
  • Error 429 (Too Many Requests)
  • There was a problem with the server 429
  • 429. That’s an error.
  • 429 server error

Here is an example of the 429 HTTP status code on Google Chrome.

HTTP 429 Error on Google Chrome

Apart from websites, you may see the error code in online tools such as SSL installers. Below is an example of SiteGround’s Let’s Encrypt SSL installer in Site Tools, producing the error 429 Too Many Requests when you reach the rate limit of certificate requests.

HTTP 429 Error in Let's Encrypt SSL Installer

What Causes the HTTP 429 Error?

The HTTP 429 Too Many Requests error occurs when the server receives too many requests from a client within a given period of time. Thus, the client exceeds the rate limits set by the server. This can happen due to various reasons, such as:

  1. Server Resource Limits – Every web server has certain resource limits in terms of CPU usage, memory, and other server resources. If your website exceeds these limits, it can trigger the 429 Too many requests error. This can happen if your website receives a sudden surge in traffic or if you are on a shared hosting plan with limited resources.
  2. Brute-Force Login Attempts – Brute-force attacks are a type of malicious attack where an attacker tries to gain unauthorized access to your website by systematically trying different username and password combinations. This can result in multiple requests being sent to the server within a short period of time, triggering the 429 error.
  3. High Traffic Volume – If your website experiences a high volume of traffic, especially during peak times, it can result in multiple requests being sent to the server simultaneously, causing the server to exceed its rate limits and trigger the 429 error.
  4. Numerous requests to the website server A user may be sending a large number of requests to the website server. In such a case, the server may respond with the 429 Too Many Requests code in such a case.
  5. Unoptimized database – Your website’s database may not be in optimal shape. It may be full of junk content, transient data, or leftover tables, bloating its size. This can make the execution of database queries longer, exhausting the server resources. As a result, the website may produce an HTTP 429 error.
  6. WordPress plugins – Occasionally, a WordPress plugin may stop working as expected and create conflicts with other parts of your website. This may lead to timeouts or a large number of executions consuming substantial web server resources.
  7. WordPress themes – Like plugins, themes may also stop working normally, leading to the 429 Too many requests error.

Now that we know what causes the HTTP 429 Too Many Requests error, let’s look at an example of the 429 Status Code.

429 Status Code Example

When you encounter a 429 Too Many Requests error, you will typically see a message on your screen. The exact wording may vary depending on the server and the application you are using. Nevertheless, it usually includes a 429 status code indicating that too many requests have been made.

The HTTP error may also provide additional details explaining why the error occurred and how to resolve it. Here’s an example of what an HTTP 429 error message might look like:

HTTP/1.1 429 Too Many Requests

Retry-After: 3600

Content-Type: application/json

{

"error": {

"code": 429,

"message": "Too Many Requests: You have exceeded the rate limit. Please try again after 1 hour.",

"details": "You have made 500 requests within the past 10 minutes. The rate limit is 100 requests per 10 minutes. Please reduce the frequency of your requests.",

"retry_after": 3600

}

}

In this case, the server has set a rate limit of 100 requests per 10 minutes. However, the client has made 500 requests within the past 10 minutes, exceeding the limit. The server has specified a Retry-After header indicating that the client should wait for 1 hour before making further requests.

How to fix the HTTP 429 error?

The HTTP 429 error, commonly called the ‘Too Many Requests’ error, occurs when a user exceeds the rate limits set by a server or API. It usually results from sending an excessive number of requests within a specified time frame.

This error can disrupt the normal functioning of an application or service that relies on the server or API, but fortunately, there are several solutions that can resolve it.

We will explore some practical steps to fix the HTTP 429 error, including adhering to rate limits, optimizing request frequency, and more.

Use a Content Delivery Network (CDN)

A content delivery network (CDN) is a network of servers that are distributed across multiple locations worldwide. When a user visits your website, the CDN serves the static assets (such as images, CSS, and JavaScript files) from the server closest to the user’s location. This helps to reduce the load on your web server and prevent the 429 error.

You can use a CDN service, such as SiteGround CDN, to distribute your static assets across multiple servers and serve them to users from the nearest server. This can greatly improve your website’s performance and reliability, especially during high traffic.

All SiteGround users can benefit from using the SiteGround CDN, available on all plans. You can activate it from Site Tools > Speed > CDN. Choose between the Free and Premium plan by pressing the corresponding Activate button of either option.

Use SiteGround CDN to fix the HTTP 429 Error

Learn more about SiteGround CDN in this tutorial on how to manage your CDN through the CDN tool in Site Tools.

Optimize Your Database

A poorly optimized database can increase the load on your server. Consequently, your website may suffer from slow performance and high resource usage, leading to the 429 error. To fix this issue, you can optimize your database to reduce its size and improve its performance.

You can use plugins for your WordPress website to clean up your database. They can remove unnecessary data, such as post revisions, spam in the comments section, and transient options. We recommend the SiteGround Optimizer plugin available to all users. It has the Scheduled Database Maintenance option, which cleans your database of junk data weekly.

To activate it, open the SiteGround Optimizer menu in your WordPress dashboard. Navigate to the Environment section and press EDIT for Scheduled Database Maintenance.

Use Scheduled Database Maintenance in SiteGround Optimizer to fix HTTP 429 Error

In the following pop-up window, select the actions the maintenance should perform and press CONFIRM.

Options for Scheduled Database Maintenance in SiteGround Optimizer

Additionally, you can repair and optimize your database tables using the built-in database optimization features in phpMyAdmin. For more information, read this guide on how to optimize a MySQL database.

Optimize the database from phpMyAdmin to fix the HTTP 429 Error

Use Rate Limiting on the Client Side

One effective way to prevent the HTTP 429 error is to implement rate limiting on the client side. Rate limiting is a technique that limits the number of requests a client can make within a specified time period. Using this method, you can prevent clients from making too many requests and exceeding the rate limits set by the server.

You can implement rate limiting by using libraries or frameworks that provide rate-limiting features or custom rate-limiting logic in your code. For example, you can set a limit on the number of requests a client can make within a certain time period (e.g., 100 requests per 10 minutes) and block or delay further requests from the client if the limit is exceeded. This can help prevent the 429 error and ensure that clients do not overload your server with too many requests.

Change Your Default WordPress Login URL

Brute-force attacks often cause the 429 error. In these attacks, automated bots repeatedly attempt to log in to your website using different combinations of usernames and passwords. Hiding your login URL or moving your default WordPress login page, you can add an additional layer of security and protect your WordPress admin area.

You can easily change the login URL to something custom with WordPress plugins like SiteGround Security. By doing so, bots will have a harder time finding and targeting your login URL. This can reduce the number of unauthorized login attempts and help prevent the 429 error.

Use Custom Login URL to prevent HTTP 429 Error

Learn more about this feature in the SiteGround Security tutorial about Login Security.

Switch to a Default WordPress Theme

If you recently installed a custom theme or made changes to your theme’s code, it’s possible that it could be causing conflicts or overloading user or server resources, resulting in the 429 error. In such cases, reverting to a default WordPress theme can help isolate and fix the issue.

You can switch to a default WordPress theme, such as Twenty Twenty-One or Twenty Twenty, to see if the error persists. If the error goes away, your previously active theme was most likely causing the issue. You can then investigate and fix any conflicts or performance issues related to your custom theme. Consider contacting the theme’s support or using a different theme altogether.

If the error doesn’t stop you from accessing your website’s backend, log into your WordPress dashboard. Navigate to Appearance > Themes. Here you can choose the active theme between all installed themes on your website. To switch the theme, press the Activate button on one of your default themes.

Switch to a default WordPress Theme to fix the HTTP 429 Error

The error “Too many requests” may prevent you from logging into the WordPress dashboard where you can change the theme. In this case, you can change the active theme from the wp_options table in the website’s database. Check this guide on how to change the WordPress theme from the database for detailed instructions.

Clear Your Browser’s Cache

Sometimes, your browser can store outdated or corrupted cached data triggering errors when loading web pages, including the 429 HTTP status code. Clearing cached browsing data can help resolve such issues and ensure that you are loading the latest version of your site.

You can typically clear the cache from your browser’s settings menu. Read the following guides to find the steps for your browser or device.

  • How to clear cache on desktop browsers
  • How to clear cache on Android
  • How to clear cache on iPhone

Flush Your DNS Cache

Computers store local DNS (Domain Name System) cache that keeps the information about domain name to IP address mappings. If the DNS cache becomes outdated or corrupted, it can result in issues with connecting to your website and trigger the 429 error.

Flushing your DNS cache will force your computer to fetch the latest DNS information and can help resolve DNS cache-related issues. Read the following guides to clear the DNS cache on your particular operating system (OS):

  • How to clear the DNS cache on Mac
  • How to clear the DNS cache on Windows
  • How to clear the DNS cache on Linux

Limit Brute-Force Attacks

Brute-force attacks can trigger the HTTP error 429 by sending multiple requests to your server within a short period of time. To prevent brute-force attacks, you can implement measures to detect and block suspicious login attempts.

One common technique is to implement a CAPTCHA or reCAPTCHA system on your website’s login page. CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) is a security measure that requires users to complete a challenge (such as typing a series of distorted characters) to prove that they are human and not bots. reCAPTCHA is a more advanced version of CAPTCHA that uses machine learning algorithms to detect and block suspicious login attempts.

If your website is WordPress-based, you can easily protect your pages with reCAPTCHA with a plugin. One of the most popular ones is reCaptcha by BestWebSoft. Download the plugin and activate it from Plugins > Add New in your dashboard.

Activate reCAPTCHA plugin to stop bots and fix HTTP 429 Error

Read the manual for configuring the plugin with Google reCAPTCHA. You can select which sections of your website will be protected by reCAPTCHA. It’s recommended to secure your login page and comments section, which are commonly targeted by bots. Once the reCAPTCHA is active, users will have to complete a visual challenge in order to log in or post a comment to your website.

CAPTCHA protection from bots on comments section in WordPress to prevent HTTP 429 error

Check for Server Resource Limits

The error 429 “Too many requests” can also occur if your site exceeds the resource limits set by your hosting provider. These limits may include CPU usage, memory usage, and a maximum number of concurrent connections. Checking for server resource limits and increasing them if necessary can help resolve the error.

You can contact your hosting provider or check your hosting account’s control panel for information on resource limits. SiteGround users can monitor their resource usage from their Client Area > Services > Hosting. Click on the Manage button of the hosting plan.

Manage section in SiteGround User Area to check the usage statistics

Select the Statistics tab to check the various resources used on your plan.

Statistics page on a SiteGround hosting account

If you are on a shared hosting plan, you may need to upgrade to a higher plan to ensure sufficient resources for your WordPress website.

Check the access logs and block suspicious IP addresses

In many cases, the HTTP error 429 is caused by bots or malicious visitors with a specific IP address. Their activity should be recorded in the server access logs. Usually, you should be able to inspect the access logs in your account’s control panel. After you identify the offending IP, you can block it from spawning new requests.

SiteGround users can check the logs in Site Tools > Statistics > Access Log. The logs show all requests to your website and from which IP addresses they originate.

Check the Access Logs to identify offending IP addresses

After you identified a suspicious IP, you can block it from accessing your website. In Site Tools, you can use the tool Security >Blocked Traffic. Type the IP address in the field IP/IP Range and confirm with the Block button.

Block suspicious IP addresses to stop the HTTP 429 Error

Learn more about the tool in this guide on how to block an IP and remove an IP block in Site Tools.

Temporarily Deactivate All of Your WordPress Plugins

A misconfigured WordPress plugin could be also causing the HTTP error 429 “Too many requests.” Your primary goal should be to access your dashboard and see if a plugin is triggering the error.

If the HTTP error 429 doesn’t prevent you from accessing the backend, log in and navigate to Plugins > Installed Plugins. Check the box Plugin to select all plugins, choose Deactivate from the Bulk actions menu and press Apply.

Deactivate all WordPress plugins to stop the HTTP 429 error

If one of your plugins is the culprit, the HTTP error should seize. Enable the plugins one by one by pressing the Activate button for each plugin until the HTTP error returns. This way, you will identify the problematic plugin.

Activate your WordPress plugins one by one to identify the one causing HTTP 429 Error

Unfortunately, the error often persists even on the login page, preventing you from logging into your dashboard. In this case, you’ll have to use an alternative method to disable the plugins. For the sake of easier WordPress management, SiteGround has developed a feature to quickly disable all plugins with one click.

Go to Site Tools > WordPress > Install & Manage. Click on the Actions (kebab) menu and select Disable all plugins.

Disable all WordPress plugins from Site Tools to stop HTTP 429 Error

Once you have disabled the plugins, you should be able to access your WordPress dashboard. Proceed with activating the plugins one by one to find the problematic plugin.

If the options above are not available to you, you can disable the plugins directly from the database. Learn more about this option from this guide on how to disable the WordPress plugins from the database using phpMyAdmin.

As a last resort, you can also deactivate the plugins by renaming the plugins folder of your WordPress files via File Manager or FTP. The folder path is:

yourwebsite.com/public_html/wp-content/plugins

Rename the folder to anything else, for example – plugins.deactivated or plugins1.

Rename the "plugins" folder in WordPress to stop HTTP 429 error

If you can access your site normally after disabling your plugins, your next move should be to restore the plugins directory to its original name. Once you do that, open the folder via FTP or File Manager and start working your way down the list of active plugins. For each plugin, you’ll want to change its individual folder name, which will disable it. Then check to see if the error persists. Once you identify which plugin was causing the problem, you can keep it disabled, report the plugin authors and ask for a solution, or find a substitute plugin.

Summary

Encountering the status code HTTP 429 Too Many Requests error is a common occurrence for websites of all types. This error can stem from various causes, such as:

  • database optimization issues,
  • server resource limits,
  • brute-force attacks,
  • clients that send too many requests.

Resolving this error may involve taking measures such as optimizing the database, monitoring and adjusting server resource limits, and implementing security measures against brute-force attempts.

Seeking professional help or consulting with your hosting provider is recommended if you’re uncertain about implementing these solutions. By addressing the underlying issues, you can ensure the smooth operation of your website and provide a better user experience to your visitors.

429 Error – Too Many Requests HTTP Code Explained

Whether you are a web developer or you are a regular internet user, you might have encountered a 429 error. It means that the website can’t handle the number of requests being sent to it.

For a developer, this error can be hard to resolve because, on many occasions, it doesn’t show what you need to do to fix it.
deve-429

But if you’re surfing the net as a user and you encounter the error, there could be a hint showing what to do.
429-clinet

In this case, you should wait a bit to make another request. For security reasons, the period of time to wait might not be specified. But if the website proritzes user experience, they’ll show you how much time to wait before making another request.

In this article, I will explain what the 429 error means and how a developer might have implemented it. I will also show what you can do to resolve it as an internet user.

What is the 429 Error?

The 429 error is an HTTP status code. It tells you when the use of an internet resource has surpassed the number of requests it can send within a given period of time.

This error might be shown to you in another form like:

  • Error 429
  • 429 Too many requests
  • 429 (Too many requests)

It all depends on how the administrator in charge of the internet resource customizes it.

In the small app I built to show you how rate limiting is implemented in an Express app, this is how I customized the error:
custom429

With this error, the administrators in charge of a website or internet resource are telling you they don’t have enough resources to handle the number of requests you are sending over. This is called “rate limiting”.

What Causes the 429 Error?

The most common cause of the 429 error is not having enough resources to handle so many concurrent requests.

For example, if this error is shown on a hosting server, it could mean that the package you’re using has a limit for the number of requests you can send.

And if the error comes up while making an API request, it means you’ve exceeded the number of requests you can make for a certain period of time.

Also, if a user tries to access a page on a website too often, the server of that website could trigger a rate-limiting feature implemented in it. So, this is a good security measure to put in place in order to prevent attacks from hackers.

For example, this is how you can implement rate limiting in an Express app using the express-rate-limit package:

// Import deps
const express = require("express");
const rateLimit = require("express-rate-limit");

const app = express();

// Port
const port = 4000;

const limiter = rateLimit({
  windowMs: 5 * 60 * 1000,
  max: 5, // Limits each IP to 5 per 15 minutes
  message:
    `<h1 style='display:flex; align-items:center; justify-content:center; height:100vh'>
     429 - Too many Requests <br> Try again later!
    </h1>`,
});

// Apply to all requests
app.use(limiter);

app.get("/", limiter, (req, res) => res.send("Hello World!"));

app.listen(port, () => console.log(`App listening on port ${port}!`));

And when the limit is surpassed for the number of seconds specified, this message gets shown to the user:
custom429

What you can do to Resolve the 429 Error

As an internet user, you should wait a bit before making another request. But if the error persists, you should contact the website administrator.

If you’re a web administrator, you should reduce the number of requests you make within the specified time (if any). If you are in control of the limit yourself, you should increase it for a particular period of time.

If the website you’re handling is a WordPress website, one of your plugins or themes might be causing the 429 error. You should disable your site plugins and themes one by one to see which one of them is the cause.

If the error is related to hosting, you should contact the customer care service of your hosting provider.

Conclusion

No website admin wants their server to get clunked up or crash. So, from a technical perspective, the 429 error is not an error. It’s the server’s way of telling you it doesn’t have enough resources to handle the high number of requests you’re making.

Thank you for reading.



Learn to code for free. freeCodeCamp’s open source curriculum has helped more than 40,000 people get jobs as developers. Get started

When browsing the internet, you might run into various unexpected errors: HTTP 500, HTTP 503, HTTP 403, and — of course — HTTP error 429.

Site owner fixing HTTP Error 429

HTTP error codes such as 429 are a challenge because they often block you from accessing a website. To make sure you understand and can fix this problem, we’ll go over what “HTTP error 429: Too many requests” means and how to fix it.

Download Now: How to Use an API [Free Ebook]

HTTP Error 429 is an HTTP response status code that indicates the client application has surpassed its rate limit, or number of requests they can send in a given period of time. Typically, this code will not just tell the client to stop sending requests — it will also specify when they can send another request.

As a website owner, you’ll run into an error message from time to time. Some of these errors will be relatively simple to solve, while others will be more intricate. Take the HTTP error 429 for example.

http 429 error

Image Source

Troubleshooting this error is complicated because it provides few details on what it is or how to solve it. You know something’s wrong and you need to fix it — but you’re not exactly sure what happened or why.

Causes of HTTP Error 429: Too Many Requests

A 429 response is not technically an error — it’s a response from a server, application programming interface (API), or plugin that tells the client application to stop sending requests because they simply don’t have enough resources to accept it at this time.

The client application usually refers to a website or app, but can also refer to individual users like the site admin or a site visitor or hacker.

A 429 error may appear the following ways, with or without the phrase “too many requests”:

  • HTTP error 429

  • HTTP code 429

  • HTTP error code 429

  • HTTP status code 429

  • HTTP response code 429

  • Response code 429

  • 429. That’s an error.

  • 429 server error

  • There was a problem with the server 429

  • Problem with the server 429

Here are some of the potential causes:

Repeated Requests to the Server

A 429 is often triggered by repeated requests. For instance, if a user is trying to access a page on your website too often in a short period of time, your server may send a 429 error.

Any website or app could experience this error, including Facebook, Etsy, Doordash, Venmo, YouTube, PayPal, Airbnb, Google Search Console, and — of course — WordPress websites (more on how to fix WordPress 429 errors below).

Brute-Force Login Attempts

In the case of a brute-force login attempt, in which a hacker repeatedly tries to log into your site, the 429 error code is an important security measure. It sets a rate limit for additional requests, preventing the brute-force attacker from being successful.

Server Resource Limits

You might also get a 429 error if your website is using up too many resources on a shared hosting server or service. If, for example, more than 50 requests are received from an IP address within one minute, PayPal Sandbox will block that IP for the next five minutes.

While the 429 response may seem punitive, it’s actually a protective measure against users intentionally or accidentally abusing server resources (or an API, plugin, or another service). It’s designed to prevent a backup or overflow of requests that would strain a server, or other service, that is meant to be shared and consumed by many websites and apps. So, by controlling the number and timing of requests, rate limits prevent problems before they arise.

If you are seeing the HTTP 429 error on your site for other reasons, you may need to reduce the number of server requests or API calls you’re making.

How to Fix an HTTP 429 Error

  1. Wait to send another request.
  2. Clear your browser’s cache.
  3. Flush your DNS cache.
  4. Implement exponential backoff.

Most of the steps below focus on avoiding, rather than retroactively fixing, an HTTP 429 error. Take a look.

1. Wait to send another request.

The simplest way to fix an HTTP 429 error is to wait to send another request. Often, this status code is sent with a “Retry-after” header that specifies a period of time to wait before sending another request. It may specify only a few seconds or minutes.

Here’s an example that asks the client to wait an hour before sending another request.

 

HTTP/1.1 429 Too Many Requests

Content-Type: text/html

Retry-After: 3600

<html>

<head>

<title>Too Many Requests</title>

</head>

<body>

<h1>Too Many Requests</h1>

<p>Only 100 requests per hour per logged in user is allowed on this website. Try again soon.</p>

</body>

</html>

2. Clear your browser’s cache.

If waiting doesn’t work, try clearing your browser’s cache, which stores your browsing data as well as requests. If you no longer have this data stored in your browser, your next request may go through.

To do so in Chrome:

  • Click CMD + Shift + Delete on Mac or Control + Shift + Delete on Windows.

  • The “Clear browsing data” analog pop up.

  • Click on the Advanced tab.

  • Select the time range and the data you’d like to delete.

  • Click Clear data.

http error 429: clear cache on browser

To find instructions for your specific browser, click here.

3. Flush your DNS cache.

Flushing your DNS cache is another option if clearing your browser’s cache doesn’t work. Your computer’s DNS cache saves your domain name server requests so that it can load websites more quickly the next time you access them. Unfortunately, this may result in HTTP error 429 if you’ve made numerous requests before the DNS cache’s time-to-live naturally expires.

http error 429: flush dns cache

To clear your DNS cache on Mac, take the following steps:

  • “Open Finder.

  • Click Applications.

  • Scroll down to the Utilities folder and click it.

  • Open Terminal.

  • In the Terminal window, enter the following command string: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

  • Click enter, then input your admin password.

  • Click enter again.”

Find instructions for more operating systems here.

4. Implement exponential backoff.

If waiting, clearing your cache, or flushing your DNS cache don’t work, look for a “Retry-after” header again. If one is not sent and you don’t know how long to wait before trying, you should implement retries with exponential backoff.

Using this approach, you will not immediately repeat a failed request; instead, you will perform a series of retries with progressively longer wait times between each attempt. When the request is finally accepted, then you will know what wait time or rate is acceptable.

You can do this manually by using an exponential backoff calculator. Here’s how:

  • Access a calculator such as exponentialbackoffcalculator.com.

  • Input a time interval, such as 2 seconds.

  • Input the maximum number of retries or requests you’d like to make.

  • Input an exponential for subsequent requests.

  • Use a manual alarm or timekeeper to make new requests at the resulting timestamps.

http error 429: use exponential backoff calculator

Alternatively, if you’re a developer or advanced user, you can add code to implement this approach. For instance, you can use a framework like Celery that comes with a built-in exponential backoff module.

Celery comes with built-in exponential backoff feature for fixing the HTTP 429 error

Image Source

The steps discussed above are general fixes for the 429 “Too Many Requests” Error. If you have a WordPress site, then you may need a WordPress-specific solution.

How to Fix HTTP 429 Error on WordPress

If you’re getting an HTTP 429 error on your website, this can pose an issue to you as a WordPress administrator and also hamper your website’s user experience. Here are some tips you can follow:

1. Wait before re-accessing your website.

Your WordPress hosting provider may be receiving too many requests to load your website, resulting in an HTTP 429 error. This is especially likely if you use shared hosting, where your website is only allotted a limited number of resources on the host’s server.

In that case, be patient — the error will resolve on its own. If it keeps happening, however, you might want to upgrade to a dedicated hosting or VPS hosting plan.

You can also try clearing you cache, flushing your DNS cache, and trying exponential backoff during this step.

2. Hide or move your default WordPress login page.

Sometimes, HTTP 429 errors can arise due to cybersecurity attacks such as brute-force attacks on your WordPress login page. You can determine whether you’re under a cybersecurity attack in several ways:

  • Check your traffic sources using a WordPress traffic plugin or a tool such as Google Analytics. If you’re seeing a spike in traffic without a valid reason (such as a marketing or advertising campaign), then you may be under attack.

  • If the traffic source is from an unfamiliar country, that may also be a sign that someone from that location is trying to hack you.

  • If the traffic source is from one specific IP address, that may a sign that a single attacker is trying to login to your backend.

To move your default login page, you only need to change its URL. That can be easily done using the WPS Hide Login plugin.

Here’s how to use it:

  • Install the plugin through your WordPress admin dashboard.

  • Access the plugin’s Settings page.

  • Next to Login URL, add the new slug for your login page.

  • Click Save Changes.

http 429 error: change wp login page slug

Save the new URL somewhere for safekeeping — the last thing you want is to forget where to login!

3. Deactivate your plugins one-by-one.

If you’re still getting HTTP error 429 after waiting, clearing your cache, and checking for brute force attacks, it’s time to look at the next likely culprit: WordPress plugins.

WordPress plugins offer a wealth of functionality to WordPress website owners, but they can also cause performance issues, including HTTP errors such as 429.

Rather than deactivating them all at once, do so one-by-one so that you can isolate the culprit. Here’s how:

  • On your WordPress dashboard’s sidebar, tap Plugins > Installed Plugins.

  • Click Deactivate on the first plugin.

  • Check to see if this resolves the issue by accessing your website through an incognito window.

  • If not, deactivate the next one until all plugins are deactivated.

  • Activate them one-by-one once you’re finished.

http error 429 on wordpress: uninstall plugins

4. Uninstall your custom theme.

If you’re using a custom WordPress theme from a marketplace such as ThemeForest or Envato, that may be the culprit. Make sure you save a backup of your website prior to deactivating the custom theme and temporarily installing a default WordPress theme.

5. Set your own throttling limit for any APIs.

An advanced technique you can try is to set a throttling limit if you’re using APIs on your website. Throttling is the process of limiting the number of requests an application can submit in a given amount of time. If this limit is exceeded, the server or API requests will typically be dropped or fulfilled with cached data.

While this approach is most often used by third-party APIs or platforms to prevent client apps from exceeding their limits, it can also be useful for restricting your own consumption of third-party APIs or server resources.

In fact, you can implement a stricter throttling limit for yourself to prevent going over the limits of a server, API, or other service you’re using. This is an especially good idea if you’re using a costly API, like the Twitter API, and don’t want to exceed your usage policy.

6. Contact your hosting provider.

Contacting your hosting provider is always an option for any error on your website, but it should be one of the last options you try.

If you’ve tried the steps above and are still seeing the 429 error, it’s possible that the cause originated from your server and not your website. It’s also possible that your host blocks requests from specific third-party services or platforms, like Google Search Console, which makes lots of requests to websites. By reaching out to your provider, they may be able to solve the issue or provide valuable insight.

How to Avoid an HTTP 429 Error

The most simple way to avoid this error is to reduce the number of requests made in a short period of time. The server is keeping track of how many requests per time unit you make and will enforce it — leading to a temporary block if exceeded. Some servers send this information in the header, on rare occasions.

And remember, receiving a 429 is not necessarily an error, it’s the server’s way of telling you your rate of requests is too high and not willing to accept those actions.

Though in some instances, the reason for the error may be your server rather than with your website. If that’s the case, nothing you will do from your side will help and you should contact your hosting provider for a resolution.

Resolving the HTTP 429 Error

An HTTP 429 error is common, but can be avoided by paying attention to rate limits set by your server, API, plugin, or more. If you exceed those limits, there are steps you can take to resolve a 429 error. By doing so, you’ll continue to provide visitors with a seamless user experience on your site.

This article was originally published in December 2020 and has been updated for comprehensiveness.

api

Понравилась статья? Поделить с друзьями:

Интересное по теме:

  • Неизвестная ошибка сети инстаграм при входе что
  • Неизвестная ошибка smtp error code 3 1с отчетность
  • Неизвестная ошибка сервера на госуслугах что это значит
  • Неизвестная ошибка rogue company
  • Неизвестная ошибка сервера на госуслугах что делать

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

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