0

I have an Nginx reverse proxy listening on port 80 and a lot of services running over other ports or subpaths in our scenario. The outside requests are proxied to the right service / API / server based on the requested route.

Like this:

Current scenario

Some requests are just to check the environment health and responsiveness status, and currently, I have to send a request to health check each one of the inner services from outside.

This Nginx proxy runs on a Windows VM and the inner services can be in the same VM, on a container, other subnets, and so on...

I'm trying to configure one route on Nginx proxy to respond with a single body containing the health response of all inner services.

The desired scenario would be like this:

Desired scenario

I've read about the njs module that could do the trick, but it looks like runs only on Linux and MacOS.

Have you guys any idea on how can I achieve this?

Diego Rafael Souza
  • 5,241
  • 3
  • 23
  • 62
  • 1
    This is not an ideal thing to do, because if a service is not responding then you will need to have a timeout for that service, and then this combined request will held till that timeout. So one bad service can impact status reporting of all good services. But if you still feel you need to go that route, then you should add an additional service which does the collation of health checks and expose a single endpoint to this service via nginx – Tarun Lalwani Mar 12 '21 at 07:03
  • @TarunLalwani yes, I'm well aware about this side effect and it's not a problem. The individual checks will keep being available, so I can know which services is not responding, but in the first sight I have to know that there's something wrong in that instance. – Diego Rafael Souza Mar 16 '21 at 08:35
  • See if this servers your use case https://github.com/prometheus/blackbox_exporter – Tarun Lalwani Mar 16 '21 at 09:31
  • Humn... that looks a bit harder than I'm intending to. In the last case, I'll prefer to build a small app that does the trick as you've suggested in your first comment. But thank you so much for your time. – Diego Rafael Souza Mar 17 '21 at 12:53

0 Answers0