# 排查 429（速率限制）问题

**URL:** <https://meta.discourse.org/t/troubleshooting-a-429-rate-limit/81060>\
**Category:** Self-hosting\
**Created:** [2018年二月20日 18:20 UTC](https://meta.discourse.org/t/troubleshooting-a-429-rate-limit/81060 "2018-02-20T18:20:41Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![AstonJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/astonj/32/215041_2.png) [@AstonJ](https://meta.discourse.org/u/AstonJ)\
**Post date:** [2018年九月19日 23:22 UTC](https://meta.discourse.org/t/troubleshooting-a-429-rate-limit/81060/11 "2018-09-19T23:22:39Z")

</div>

_Coming back to this Topic as the [other one](https://meta.discourse.org/t/intermittent-performance-issues/97391/) is slightly different._

Do we still need to be doing something like in [the post](https://meta.discourse.org/t/troubleshooting-a-429-rate-limit/81060/7) above?

Looking through the `/etc/nginx/conf.d/discourse.conf` file there seems to be no mention of `set_real_ip_from` (searching the Discourse repo for the same yields no results either). From the `discourse.conf` file these seem most relevant:

(mentions of `IP`)

```plaintext
    # This big block is needed so we can selectively enable
    # acceleration for backups and avatars
    # see note about repetition above
    location ~ ^/(letter_avatar/|user_avatar|highlight-js|stylesheets|favicon/proxied|service-worker) {
      proxy_set_header Host $http_host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Request-Start "t=${msec}";
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $thescheme;

```

```plaintext
    # we need buffering off for message bus
    location /message-bus/ {
      proxy_set_header X-Request-Start "t=${msec}";
      proxy_set_header Host $http_host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $thescheme;
      proxy_http_version 1.1;
      proxy_buffering off;
      proxy_pass http://discourse;
      break;
    }

```

```plaintext
    # auth_basic on;
    # auth_basic_user_file /etc/nginx/htpasswd;

    location ~* (assets|plugins|uploads)/.*\.(eot|ttf|woff|woff2|ico)$ {
      expires 1y;
      add_header Cache-Control public,immutable;
      add_header Access-Control-Allow-Origin *;
     }

    location = /srv/status {
      access_log off;
      log_not_found off;
      proxy_set_header Host $http_host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Request-Start "t=${msec}";
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $thescheme;
      proxy_pass http://discourse;
      break;
    }

```

Which appear to be setting the correct remote address 😕

For completeness I received a couple of `429s` after a peak in traffic a couple of days ago, and looking at my app.yml I found that the `set_real_ip_from my.server.ip;` and `real_ip_header CF-Connecting-IP;` lines were commented out… but it doesn’t look like they do anything anyway? Can you remember what the [outcome](https://meta.discourse.org/t/troubleshooting-a-429-rate-limit/81060/8) of your [investigations](https://meta.discourse.org/t/troubleshooting-a-429-rate-limit/81060/9) were after?

_Currently I am recommending adding those lines to the app.yml in the following guide: [Set up Discourse on a server with existing Apache sites](https://meta.discourse.org/t/how-to-set-up-discourse-on-a-server-with-existing-apache-sites/30013) (and so may be giving bad advice to others?)_

---

_[View the full topic](https://meta.discourse.org/t/troubleshooting-a-429-rate-limit/81060)._
