You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d0979c0
Browse filesBrowse the repository at this point in the historyBrowse files
media-auth is the nginx auth_request subrequest, called once per
attachment displayed in a document. It shared the 80/minute "document"
bucket with every other document endpoint, so a document with many
images, or anonymous readers behind a shared NAT (keyed by IP), got 429
answers and broken images, reported to Sentry as "Rate limit exceeded
for scope document".
DRF's ScopedRateThrottle reads the scope from the view's throttle_scope
(the class attribute of DocumentThrottle is overwritten), so the action
now sets throttle_scope="media_auth", with its own rate configurable by
API_MEDIA_AUTH_THROTTLE_RATE. The default, 200/minute, no longer shares
its budget with the other document endpoints and leaves room for a
document holding many images to be opened several times a minute. The
check is a read-only authorization (two indexed queries and a HEAD on
the object storage), whose real protection is the permission check.
Signed-off-by: Anthony LC <anthony.le-courric@mail.numerique.gouv.fr>
0 commit comments