0

I want to check if port is open using javascript and reverse nginx proxy.

I have scenario, when page behind nginx proxy can either return Empty Response, or return Connection Refused (if the service is down). Both times, nginx reverse proxy will return 502 - Gateway timeout.

Is it possible to differ somehow this replies and return different answers, so javascript can do analize response from nginx proxy and print on page "Server is alive" or "Server is dead"?

Nginx config:

location ~* /proxy/(.+)$ {
  proxy_pass http://$1;
  proxy_set_header X-Real_IP $remote_addr;
}

And requested URL's are like: http://this_server/proxy/another.server.hostname:12345. So port 12345 on another.server.hostname can either make EMPTY_RESPONSE, or be in CONNECTION_REFUSED state. It's not HTTP port at all

MasterClass
  • 355
  • 1
  • 3
  • 10

0 Answers0