Unexpected 502 & 504 gateway error on wordpress

Hello, Having a really annoying issue with cloudflare, I am not sure where is the problem.

I am running a wordpress site with nginx, cloudflare domain in a server from AWS.

Now, If I want to delete 200 files from wordpress, I get mix error of :
502 bad gateway and 504 Gateway Timeout

I have checked my server health, no CPU increase or anything, so it tells that server can handle this request easily.

From nginx error.log I get this error :
[error] 27047#27047: *21724 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 162.158.165.16, server: domain.com, request: GET (wordpress large query)

this ip : 162.158.165.16 belongs to cloudflare right?

What is the issue here? how can I solve it? Any suggestions would be appreciated.

Cloudflare will only wait 100 seconds (my memory may be off a bit), so this doesn’t surprise me.

If you need to do long running operations that exceed Cloudflare’ s timeout, I suggest you add your domain to your computer’s local hosts file and connect directly to your server to administer it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.