Skip to content

Fix throttling documentation about Remote-Addr #5414

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 12, 2017

Conversation

knaperek
Copy link
Contributor

There's no such HTTP header called Remote-Addr and the throttling code is indeed not using any HTTP variable to get this.
Instead it is using the WSGI environment variable REMOTE_ADDR, which may be set by the webserver according to configuration. For example, in nginx it is possible to use the nginx_http_realip_module and set it based on any HTTP header, if it comes from a trusted reverse proxy server.

On the other hand, X-Forwarded-For is a valid HTTP header and that's why it is also prefixed with HTTP_ in the request.META object.

Note: Before submitting this pull request, please review our contributing guidelines.

Description

Please describe your pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue. When linking to an issue, please use refs #... in the description of the pull request.

There's no such HTTP header called Remote-Addr and the throttling code is indeed not using any HTTP variable to get this.
Instead it is using the WSGI environment variable REMOTE_ADDR, which may be set by the webserver according to configuration. For example, in nginx it is possible to use the nginx_http_realip_module and set it based on any HTTP header, if it comes from a trusted reverse proxy server.

On the other hand, X-Forwarded-For is a valid HTTP header and that's why it is also prefixed with HTTP_ in the request.META object.
@tomchristie
Copy link
Member

Great catch, surprised that's persisted for so long.
Thanks so much for the docs fix here - nicely done. 👍

@tomchristie tomchristie merged commit 7037ce8 into encode:master Sep 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants