Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Configure the number of proxies to fix anon rate limiting (#3344)

sarayourfriend9ada4c860e8a
diff --git a/api/conf/settings/rest_framework.py b/api/conf/settings/rest_framework.py
index b994d45c1..17f305043 100644
--- a/api/conf/settings/rest_framework.py
+++ b/api/conf/settings/rest_framework.py
@@ -57,3 +57,7 @@ if config("DISABLE_GLOBAL_THROTTLING", default=True, cast=bool):
**{k: None for k, _ in REST_FRAMEWORK["DEFAULT_THROTTLE_RATES"].items()}
)
del REST_FRAMEWORK["DEFAULT_THROTTLE_CLASSES"]
+
+# https://www.django-rest-framework.org/api-guide/throttling/#how-clients-are-identified
+# We override this in live environments to an appropriate number based on our deployment
+NUM_PROXIES = config("NUM_PROXIES", default=0, cast=int)