Prevent Heroku Server from Sleeping for FREE

Oct 30, 2021
2 min read
366 words

In this article, I am gonna tell you about how you can run the Heroku server free for a lifetime. So let's get into it.

As you may have known that Heroku does not allow your app to run for more than 1 hour. When an app on Heroku has only one web dyno and that dyno doesn't receive any traffic in 1 hour, the dyno goes to sleep.

When someone accesses the app, the dyno manager automatically wakes up the web dyno to run the web process type. This causes a short delay for this first request, but subsequent requests perform normally.

So now how can we run it forever without sleep? so that web process or API request doesn't have any kind of delay.

Heroku

Firstly you need to have a Heroku app which can be a new or old one. if you don't have a Heroku app Click Here

Create an Heroku App

Now the next part is the domain of the app if you know the domain then you can skip this part. To get the domain you can go to Settings > Domain.

domain

UptimeRobot

Now is the main part we need to use service called UptimeRobot. Create an account for free and then you will see the dashboard same as below -

dashboard

Click on the Add New Monitor on the Top Left corner. It will open a dialog box

dialog

Monitor Type - should be HTTPs Friendly Name - Name of your app (anything) URL or IP - root domain of heroku app such as https://your-domain-name.herokuapp.com/ Monitoring Interval - the time difference between two requests. (recommended 20 minutes) Monitor Timeout - the max time it wait for the server to respond

Then Click on Create monitor on the bottom right corner.

After that, it will create the monitor server which will send requests to the Heroku server constantly for a lifetime and you can even check the details of the monitor and the server response time.

res

Wrapping up

With the help of UptimeRobot, we create the robot server which sends automatic requests to the server after the certain time period which we have specified earlier.

Jatin's Newsletter

I write monthly Tech, Web Development and chrome extension that will improve your productivity. Trust me, I won't spam you.

Share on Social Media: