Cloudflare 522 error on custom server

I have a custom server set up and have deployed Directus to it. Everything seems to be working properly—no deployment errors, no pm2 errors. It’s connected to a repo and deploys successfully, but I’m getting a Cloudflare 522 error when I go to the site and on the server pings.


Hello @sheffield,

It looks like you were able to resolve the issue. Any idea on what went wrong and how you were able to solve the issue?

Im having exactly the same issue right now. App went down without any notice. Everything seems green on my dashboard

@anish Currently getting 2023/03/10 10:36:53 [error] 683#683: *1873 connect() failed (111: Connection refused) while connecting to upstream, client: 172.68.51.97, server: codotto.com, request: "GET / HTTP/2.0", upstream: "http://127.0.0.1:7145/", host: "codotto.com". Trying to re-deploy it just gets stuck on Installing NPM packages

Hello @bfrancisco,

We’ll look into the issue and get back to you.

[EDITED] Your issue seems to be 502 error rather than 522.

@anish this is weird because we haven’t done any re-deployment to production in a couple of days. Yesterday things were working correctly but today things just started getting 502.

Is there a way to check logs that tell me exactly where the problem is?

Could it be that you guys released something that broke some environments?

Hello @bfrancisco,

You can find the logs from Deployments > Select the workflow > Logs Report > And click Fetch App Logs.

I can see some logs there about the failure.

We’ve not made any releases around deployments recently.

I haven’t been able to solve the issue yet. I spun up a new server on DigitalOcean to see if it was something with my custom server setup. The DigitalOcean server started and runs with no issues.

Do you know if there’s a firewall or IP whitelist or something I need to open on my custom server?

Hello @sheffield,

With custom servers, there can be so many things that can go wrong.

Can you let me know via PM the name of the site that has this issue? I checked some of your sites and they were working fine. Are you getting these errors with the free cleavr domains only?

If you’ve deleted the setup, can you create a site again and let us know?

I’ve also extended your trial by 10 days.

Thanks @anish!

I was able to resolve my issue. I switched to a new site with a custom domain, which helped me diagnose it as a firewall issue on my server. Turns out my custom server had an additional firewall on top of ufw, so it was blocking cloudflare’s access. I haven’t tested with cleavr’s test domains yet, but everything seems to be working well so far.

2 Likes