Repository navigation
Nginx config changes [staging] - #496
Conversation
mitchelljkotler
left a comment
There was a problem hiding this comment.
Why are we only limiting addon_events to the max body size? We should probably have one site wide limit.
Also, as a note, when we change to using 429 status correctly we should also update the frontend (which will require adding CORS headers to the 429) and the python library to respond to them appropriately.
We can also set a retry-after header which should make the python client respect it automatically:
# only nginx's own 429s; DRF throttles set their own Retry-After
map "$upstream_status:$status" $retry_after {
default "";
":429" 1;
}
server {
...
add_header Retry-After $retry_after always;
…18s, add Retry-After and CORS headers to nginx-generated 429s so the frontend can read them and clients can back off
I think this is ready for another look. I'll have to test the last two bulletpoints when it merges into staging. |
26c8284 to
6807b35
Compare
Returns a 429 instead of a 503 which nginx does by default for rate limited clients.
Rejects requests > 25MB in size site-wide. Github webhooks payloads are 25MB capped, Add-On events we shouldn't allow for much more than that either. Documents go to S3. Mailgun attachments are fetched by URL. This is set by NGINX_MAX_BODY_MB so we can bump it later if we need to.
Add CORS headers to the nginx 429 response and add Retry-After that the front-end and python-squarelet can key off of.
Bumps keepalive_timeout to 95s, to be >90s which is Heroku router's idle limit so we stop seeing H18. Issue
Follow-ups
Retry-After, then bump the pin in python-documentcloudTesting
nginx -tpasses on the rendered config (Done)Retry-Afterand CORS headers; normal responses don't getRetry-After