Site takes time to open and shows error if When i dont open Site for few hours

my site -

why does site takes time to open and also shows error if i dont open my site for few hours .

For instance
If i load my site after few hours and in that few hours there is 0 traffic . It wont open it loads for 10-20 sec and then It will show error 502 : Bad gateway error if i use cloudflare ( and if i dont use cloudflare it will show other error ( i dont remember exact error code )) I have to refresh my site 3-4 times to make my site work . After my site work it open fine untill i take few hours break

But I have to repeat this each and every day … This happens even if i use use default theme + no plugin + no cloudflare .
Please solve this . People leave my site as they have to wait for 10 sec and then they get bad gateway error

Looks fine from here.
The only error I got was a 404 for this image:
Probably because of the typo on the file name.

The page loaded in 2.56 seconds:

1 Like

Hello @techyOmen, your site seams to work well for me, except for the 404 the @alexvf pointed out (an image is also missing from the main page it seams). If you are experiencing loading issues, please try clearing your cache or using an incognito tab.

I am not telling that … If i open my site after 3 to 4 hours then it takes time to load and then shows 502 : Bad gateway … after i refresh the site 2- 3 times it starts working well … and it works well if there is a visitor is there or i am using site .

If a visitor and me doesnt visit page for few hours then the error comes . If I LEAVE THE SITE AND NO VISTRS ARE THERE and after 4-5 hours anyone visits my site ( even me ) then error shows up - 502. If the visitor refresh the page 2 - 3 times it get fixed and the error will not come if a different vistor comes whitin 3-4 hours

But after 3-4 hours ( for 3 hours there is no activity or visit on my site ) the first visitor who comes will get the error and if he doesnt refresh the site the next visitor will get error . But if he refresh site it will work fine

I mean that i have to reload my site completely every 4-5 hours so that the error doesnt comes .

Hope you understand what i am trying to say … ( I am not good in explaning things )

If a website hasn’t been accessed in a while, it first needs to be loaded into server caches and so on. If you visit it again right after, the site is loaded in and should be a lot faster.

This is how servers work, and you can expect infrequently accessed sites to be kicked out of the cache on any service that host multiple websites. The free hosting servers are quite heavily loaded so it’s going to be a bit slower than with most other (premium) hosting providers, but you’ll see this on premium hosting too.


Yes, but what exactly could be causing this?

StackOverflow members would ask for an MRE (a minimal reproducible example).

What this is basically saying is that you need to show us things that we can put together to go “a-ha” and tell you what’s wrong. It could be a script that resets or times out every so often and throws an error because of that, or it could simply be your computer.

Bad gateway is meaning that your server isn’t working when cloudflare retrieves info from it (which makes sense, because you said it gives another error when you don’t use cloudflare).

So, that narrowed down, can you tell us what error you get when you don’t use cloudflare?

1 Like

Yes, most hosting providers do this to help the very active sites because the ones that aren’t active don’t need as much attention. However, my site rarely gets any attention and it loads pretty fast (I can actually "
see" the startup lag from when I visit it for the first time in a while).

The weird thing is though, is that he gets a 502, meaning that his server isn’t working properly. Like I said, it could be something that timed out (lots of servers do this to preserve precious resources, like you said).

I think it’s a script that needs to be constantly on (it could be because of other reasons though). As for whether or not I’m sure, I don’t know as the asker hasn’t provided us any resources on what his scripts are doing yet.


Server caches are one possible explanation, but aren’t typically this bad.

It could also be that the WordPress Cron system is the reason that first page load takes so long. WordPress doesn’t run scheduled tasks in the background, but instead runs them on the page load. And if no pages are opened for a while, then a lot of pending tasks can pile up.

If you then have a bunch of plugins loading big tasks into the scheduler, and processing all those tasks takes a couple of minutes, then you are going to have a very slow first request and get Bad Gateway errors because all your requests are timing out.

You could try disabling some plugins and see if that helps. If you can figure out which plugin(s) are responsible for the heavy tasks, maybe you can fix this issue.

One cheeky workaround could be to setup a Cron Job in your control panel and just have it open your home page once per hour or so.


If I figure out which plugin are responsible for heavy task , i cant disable them as they are important for my site . I manage to remove 3 plugins ( heavy plugin ) 5-10 days back . But now i cant remove any plugin as they are all essential for my site .

So according to you there is a solution - to use Cron Job . Will Cron Jobs help to solve this problem ? IF yes ( and if possible ) Can you help me to setup Cron jobs that just opens my site , so that i dont get Bad gateway error .

Set up Chron Jobs

  1. Open Control Panel


Whether you want to remove the plugins is your choice. But loading many big, slow plugins into a site will make the site slow. So as I see it, the way to truly “fix” this are:

  • Optimize your website so it runs faster.
  • Accept the fact that you have a big slow site.
  • Get faster hosting (like iFastNet’s premium hosting).

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