504 gateway timeout from 1-2 locations

My site is working fine from most locations.
From Kazakhstan and russia its giving 504 gateway timeout.

It’s very unlikely that this issue is related to ERPNext. It’s possibly a server configuration issue but far more likely a hosting provider problem.

well now i get the frappe “sorry we will back soon” from kazakhstan.
I’m a little confused here, even when a VPN is used from KZ to connect to for example USA, the same issue is there, but if i connect from any where else or use a VPN (USA again) to connect there is no problem.

What do the logs say?

What logs, could you elaborate or point me to the command?
I am purging fail2ban as we speak, might be that

nope is not that either

It depends on the error message you’re getting. If it’s timing out, my first question would be whether or not it’s getting to your nginx proxy, which you can check via your nginx access logs.

The “back soon” message is odd. I wonder if the user in Khazakstan is picking up a cached page somehow. I can’t think of any mechanism by which ERPNext would be serving that page differentially to users based on ip origin.

Maybe you need to check on other sites in the same area.

My understanding from some news services is that due to the wartime stance in Russia and Russian influenced surrounding countries, there are many internet services that are restricted or completely cut off. The ones they target the most are likely sites doing business to US, UK, EU and other allied nations.

This will likely be a difficult time for anyone hosting or working from that region of the world for while.


1 Like

nope, other people in kazakhstan are having access.
I’m just confused now.
Site users are not having access. Some random people do have access some don’t!!!
Can my firewall or fail2ban restricted something?

Also I have purged and reinstalled fail2ban, is there any configuration needed for it to work on site or does bench update take care of that?

Fail2ban could certainly be a problem, but so could hundreds of other things both on your server and from your host. It is impossible for us to do anything other than wildly speculate. Logs (with nginx logs as a good starting point) are going to be the only way to troubleshoot this.

Tnx , should i post the error logs or access logs?

also sry for asking again, after i purged and reinstalled fail2ban do i need to do any configuration or does bench update take care of that?

Sorry, I should have been more clear. Don’t post complete logs here, as they may contain sensitive information. I’ve deleted the log post.

The access logs by themselves won’t tell us much. What you want to be able to isolate is whether or not your problem users are reaching the server or not. For that, I’d probably start with error logs. Is nginx logging errors when your problem users try to access? If so, what do they say?

Hi I think this is it.
upstream prematurely closed connection while reading response header from upstream
well increased the proxy_read_timeout to 300s
and everyhting is fine now

For anyone running into this.
you need to increase timeout time so here is what you must do:
go to /etc/nginx/conf.d
open frappe-bench.conf ( run nano frappe-bench.conf)
edit the proxy_read_timeout from 120 to 300
save the file
restart nginx
all done


All that remains is this question should i make a new post?
i uninstalled and reinstalled fail2ban do i need to configure it to work with erpnext or does bench update take care of that.

I don’t have much experience with fail2ban, so I’m not sure what uninstalling and reinstalling accomplished. You can configure fail2ban for frappe with the command bench setup fail2ban, but I don’t know enough to say whether it is necessary for you at this point or not.

1 Like

still same issue :frowning: