RSSAmplifier

Cory Dransfeldt • Posts · May 20, 2026

Lifting Mastodon rate limits

0
Sign in to vote or save

Cory Dransfeldt · Cory Dransfeldt

I'm a reluctant Bluesky user and a new Bluesky user. I expanded my site's syndication implementation to support Bluesky and updated my links implementation to support tagging authors on Bluesky. Why join now? I'm not totally sure. Indigo launching was a factor. It looked like (and is) a lovely app.

One thing I encountered when using Indigo was regular rate limit warnings. Having recently moved to my own, self-hosted Mastodon instance my instinct was that this was due to a misconfiguration on my server. Mastodon sets explicit rate limits in /opt/mastodon/config/initializers/rack_attack.rb and they are not configurable via an .env var or other convenient method. You can override them, but the process is a bit fiddly.

I version my infrastructure files across servers, with the files relevant to each server in ~/infra/<name>-server. I'm running the various components of Mastodon in Docker containers as I'm already comfortable orchestrating things that way. With that said, I overrode the rate limits as follows:

# copy rack_attack.rb out of the container
docker cp mastodon-web:/opt/mastodon/config/initializers/rack_attack.rb ~/infra/mastodon-server/rack_attack.rb
# bump the relevant limits
cd ~/infra/mastodon-server
sed -i "s/throttle('throttle_authenticated_api', limit: 1_500/throttle('throttle_authenticated_api', limit: 99_999/" rack_attack.rb
sed -i "s/throttle('throttle_per_token_api', limit: 300/throttle('throttle_per_token_api', limit: 99_999/" rack_attack.rb
sed -i "s/throttle('throttle_authenticated_paging', limit: 300/throttle('throttle_authenticated_paging', limit: 99_999/" rack_attack.rb
sed -i "s/throttle('throttle_media_proxy', limit: 30/throttle('throttle_media_proxy', limit: 99_999/" rack_attack.rb
# mount the rack_attack.rb file that was modified (this needs to be added to the web and sidekiq containers)
volumes:
  - mastodon-system:/mastodon/public/system
  - ./rack_attack.rb:/opt/mastodon/config/initializers/rack_attack.rb:ro
# apply the changes
docker compose up -d --force-recreate web sidekiq
# verify the change
docker exec mastodon-web grep "limit: 99_999" /opt/mastodon/config/initializers/rack_attack.rb

The warnings went away and performance improved. I can't unequivocally say this is a good idea, but it's holding up well so far.

You can follow/like/subscribe/yell at me on Bluesky if you'd like.

Read the original on coryd.dev

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.