diff --git a/rest_framework/settings.py b/rest_framework/settings.py index 02a0cd122..383de72ea 100644 --- a/rest_framework/settings.py +++ b/rest_framework/settings.py @@ -63,7 +63,7 @@ DEFAULTS = { 'user': None, 'anon': None, }, - 'NUM_PROXIES': 0, + 'NUM_PROXIES': None, # Pagination 'PAGINATE_BY': None, diff --git a/rest_framework/throttling.py b/rest_framework/throttling.py index efbef4e72..ca161ee48 100644 --- a/rest_framework/throttling.py +++ b/rest_framework/throttling.py @@ -25,7 +25,7 @@ class BaseThrottle(object): """ num_proxies = api_settings.NUM_PROXIES - if 'HTTP_X_FORWARDED_FOR' in request.META and num_proxies > 0: + if 'HTTP_X_FORWARDED_FOR' in request.META and num_proxies: xff = request.META.get('HTTP_X_FORWARDED_FOR') return xff.split(',')[-min(num_proxies, len(xff))].strip() @@ -222,7 +222,6 @@ class ScopedRateThrottle(SimpleRateThrottle): # the `__init__` call. self.rate = self.get_rate() self.num_requests, self.duration = self.parse_rate(self.rate) - # We can now proceed as normal. return super(ScopedRateThrottle, self).allow_request(request, view)