senzing-garage / entity-search-web-app

A lightweight http server providing a web UI for entity search through the senzing api server.
Apache License 2.0
2 stars 2 forks source link

When container running only under SSL `/health` endpoint check throws error. #538

Open arawinters opened 3 months ago

arawinters commented 3 months ago

Describe the bug When running the search webapp container only on the SSL port and passing the appropriate SENZING_WEB_SERVER_URL env var with a https protocol the container healtcheck script throws an error.

Reason for error there is no detection of protocol from SENZING_WEB_SERVER_URL or the SENZING_WEB_SERVER_PROTOCOL variable. http is always used.

Solution Add a switch or if/else statement to do a https.get instead of a http.get when appropriate. The following code blocks need to be modified to resolve in this scenario:

Expected behavior healthcheck responds without error.

Error Stack

TypeError [ERR_INVALID_PROTOCOL]: Protocol "https:" not supported. Expected "http:"
    at new NodeError (node:internal/errors:387:5)
    at new ClientRequest (node:_http_client:186:11)
    at request (node:http:97:10)
    at Object.get (node:http:108:15)
    at HealthCheckerUtility.checkIfWebServerAlive (/app/run/health/index.js:35:24)
    at listOnTimeout (node:internal/timers:559:17)
    at processTimers (node:internal/timers:502:7) {
  code: 'ERR_INVALID_PROTOCOL'