Skip to content

Fix DRF throttle behinnd proxy#2892

Merged
JacobCoffee merged 1 commit intomainfrom
download-ratelimit-fix
Feb 17, 2026
Merged

Fix DRF throttle behinnd proxy#2892
JacobCoffee merged 1 commit intomainfrom
download-ratelimit-fix

Conversation

@JacobCoffee
Copy link
Member

Fixes #2891

Copilot AI review requested due to automatic review settings February 17, 2026 14:56
@JacobCoffee JacobCoffee force-pushed the download-ratelimit-fix branch from aaececf to 70c64a4 Compare February 17, 2026 14:59
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds the NUM_PROXIES configuration to Django REST Framework settings to fix throttling issues when the application is behind a proxy. The setting enables DRF to correctly identify client IP addresses by parsing the X-Forwarded-For header when the application sits behind multiple proxies (CDN, load balancer, etc.).

Changes:

  • Adds NUM_PROXIES setting to REST_FRAMEWORK configuration with a default value of 3, configurable via the DRF_NUM_PROXIES environment variable

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@python python deleted a comment from chatgpt-codex-connector bot Feb 17, 2026
'anon': '100/day',
'user': '3000/day',
},
'NUM_PROXIES': 3,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before:

AWS ALB (Network) -> nginx-ingress -> nginx (container) -> gunicorn

After:

AWS ELB (Classic) ->. Traefik -> nginx (container) -> gunicorn

So... yeah I think 3 is correct since ALB doesn't do anything with X-Forwarded-For.

But why did it work before without being configured as 2?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe just traefik behaving differently from nginx ingress?

@JacobCoffee JacobCoffee merged commit 50518fd into main Feb 17, 2026
10 checks passed
@JacobCoffee JacobCoffee deleted the download-ratelimit-fix branch February 17, 2026 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

https://www.python.org/api/v2/downloads/release/ endpoint returns error

2 participants