Proxy dns setup resulting in 503

Complete this information in order to ask your question.

Have you searched for an answer?
yes

Please share your search results url:

https://support.cloudflare.com/hc/en-us/articles/115003011431-Troubleshooting-Cloudflare-5XX-errors#503error

Describe the issue you are having:
When try nig to reach from aws, we are unable to reach any subomains within the root domain when the proxy status is set to proxied.

What error message or number are you receiving?
503

What steps have you taken to resolve the issue?

  1. switched setting from proxy to dns → works fine
  2. whitelisted ip address of Cloudflare on specific resources

What is the domain name?
mysecondteacher.com.np
subdomain → aaaapi.mysecondteacher.com.np

Was the site working with SSL prior to adding it to Cloudflare?
yes

What are the steps to reproduce the error:

  1. change the setting from dns to proxy

Have you tried from another browser and/or incognito mode?
yes

Please attach a screenshot of the error:

Not able to reproduce the error; instead receiving 404 error. Looks to me the address does not exist or the record is missing. It’s in fact redirects to /swagger

If you try carrying out a curl request from any ec2 instances in aws you will receive the 503 response

try this curl request without user agent

curl https://aaaapi.mysecondteacher.com.np/health -IkL

and with user agent

curl https://aaaapi.mysecondteacher.com.np/health -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36' -IkL

This issue has been resolved for anyone facing the similar kind of issue.

here are the steps to fix it.

  1. disable Cloudflare bot protection from your setting for the dns

  2. if you still want to enable bot protection, make sure to whitelist ip address in firewall rules.