יותר מדי בקשות

סיכום מבוסס בינה מלאכותית

In a support thread titled ‘Too Many Requests,’ yerttle seeks guidance on configuring the Discourse API to preserve the original client IP address when proxying requests through a wrapper app. They tried using the X-Forwarded-For header but had no success. pfaffman replies with a configuration snippet for discourse.conf involving set_real_ip_from and real_ip_header directives, referencing a meta.discourse.org thread for context. yerttle thanks them and then follows up, confused about where to apply the changes—since /etc/nginx/conf.d/discourse.conf inside the container is dynamically generated and not persistent, and ./config/discourse.conf also doesn’t persist across restarts. They ask for clarification on where to place the configuration. pfaffman clarifies that the example shows how to modify discourse.conf during container build time, implying changes should be made via Discourse’s app.yml or container rebuild process rather than inside the running container. The thread reflects a common challenge in proxying requests through Discourse while maintaining accurate client IP tracking, with yerttle seeking a persistent, production-safe solution.

Hi there, I have built a wrapper for your forum API so we can securely get people to post forum messages from our APP without out having to include API keys etc in the APP.

Is there a header I can pass to the API so that requests appear to come from the orginating client I have tried X-Forwarded-For but don’t seem to have had much luck.

Thanks

See Last IP address and action_dispatch.trusted_proxies - #3 by mpalmer

Something like this:

    # This is the magic to get IP numbers transmitted to Discourse
    # See https://meta.discourse.org/t/last-ip-address-and-action-dispatch-trusted-proxies/50098/3?u=pfaffman
    - replace:
        filename: /etc/nginx/conf.d/discourse.conf
        from: "types {"
        to: |
          set_real_ip_from 192.168.1.0/24;
          set_real_ip_from 172.19.0.0/24;
          set_real_ip_from 172.18.0.0/24;
          set_real_ip_from 172.17.0.0/24;
          set_real_ip_from 38.242.7.193/28;
          real_ip_recursive on;
          real_ip_header X-Forwarded-For;
          types {

Thanks Jay, will take a look.

Appologies if I am not being smart here but is some able to explain this in more detail.

I have found /etc/nginx/conf.d/discourse.conf in the container but it is my understanding that it is created dynamically so making changes from within the container won’t persist restarts. I’ve also found ./config/discourse.conf which has my settings in so I assume I am supposed to add the settings above into that file but again ./config is not persisted.

A gentle nudge in the right direction would be much appreciated.

Thanks

Any chance some one can point me in the direction.

The example I provided above shows how to make changes to discourse.conf when a new container is built.