503 error by Cloudflare

Problem statement

I am using the Auth0 /oauth/token endpoint to perform Username-Password authentication. The first 10 or so attempts are successful, but after that I start encountering a 503 error. I have checked the x-ratelimit in the response header and it does not appear to have been exceeded. Can you help me understand what might be causing this issue?

Cause

You might be hitting some rate-limit on the Cloudflare side.

As mentioned here:

https://community.cloudflare.com/t/community-tip-fixing-error-503-service-unavailable-service-temporarily-unavailable/44438

An “Error 503: Service Unavailable” with no Cloudflare in the message means you need to contact your hosting provider for assistance. It generally means your host is rate limiting requests to your site or that I’m Under Attack Mode has been enabled on the domain.

A “Error 503: Service Temporarily Unavailable” with “Cloudflare” means you are hitting a connection limit in a Cloudflare data center. When this happens, please contact Cloudflare Customer Support. Include as many of the details mentioned in the Quick Fix Ideas as possible.

Solution

The solution is suggested here:

https://community.cloudflare.com/t/community-tip-fixing-error-503-service-unavailable-service-temporarily-unavailable/44438

  1. When you post, please include your domain name & the time and timezone of the 503 error occurrence and check your host logs prior to posting.
  2. When you post here, please include a traceroute between your origin and one of Cloudflare’s IP addresses, ideally one of the addresses that usually sends requests to your site. See how to run a traceroute test 506.
  3. If you are seeing a traffic surge or attack against your site, when you post in the Community, let us know if you are seeing this in the error logs from your host.
  4. Disable Always Online if it is enabled.