dani-garcia / vaultwarden

Unofficial Bitwarden compatible server written in Rust, formerly known as bitwarden_rs
GNU Affero General Public License v3.0
36.78k stars 1.79k forks source link

Healthchek failing if 'domain' is set in config.json #925

Closed andpp closed 4 years ago

andpp commented 4 years ago

Subject of the issue

healthcheck.sh script does not aware of 'domain' setting and HEALTHCHECK will fail if subfolder is used.

Your environment

Proposed Fix

Temporary I use this healthcheck.sh. It works for my setting but I as I am not familiar with the server internals, am not sure it will work for all possible variants for defining domain.

My domain definition from config.json. I do not use DOMAIN variable

"domain" : "https://my.server/bw_subfolder/",

#!/usr/bin/env sh

DM="$(cat /data/config.json | grep domain | sed -n 's|.*http.*/\(.*\)/.*|\1|p')"
if [ ! -z "$DM" ]
then
   DM="/$DM"
fi

if [ -z "$ROCKET_TLS"]
then
  curl --fail http://localhost:${ROCKET_PORT:-"80"}$DM/alive || exit 1
else
  curl --insecure --fail https://localhost:${ROCKET_PORT:-"80"}$DM/alive || exit 1
fi
jjlin commented 4 years ago

Sorry, overlooked this aspect when implementing the subpath stuff. I'll work on a fix later today.