(Heartbeat) requests from '127.17.0.1'?


#1

I started logging the IP addresses that requests come from, and noticed many unexpected requests from 127.17.0.1. I’m guessing this is a heart-beat check? Here’s some additional info I gleaned from the request object:

headers: { host: ':25536', 'user-agent': 'Go-http-client/1.1' }

It would be nice to be able to detect these requests so we can send a simple response instead of a rendering a complex page for no reason. For example, my root page handler makes AJAX requests to geocode the IP address.


#2

Hi Leftium,

We’re thinking about ways to have a less intensive heartbeat check, but in the meantime you can add this route to your express app:

app.head("/", function(request, response) {
  response.send("OK");
});

This will quickly satisfy the check without rendering or doing a lot of work.


#3

Great! That seems to work well. I was doing something similar already, but it depended on knowing the IP address of the heartbeat monitoring server. With this method it doesn’t matter where the heartbeat requests come from.