Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

fix: Healthcheck errors if Host Domain set (#1048)

Gerke van Garderen31775943f96b
diff --git a/app/cmd/ping.go b/app/cmd/ping.go
index 37db5c3bf..6357d2fc6 100644
--- a/app/cmd/ping.go
+++ b/app/cmd/ping.go
@@ -11,6 +11,10 @@ import (
//RunPing checks if Fider Server is running and is healthy
//Returns an exitcode, 0 for OK and 1 for ERROR
func RunPing() int {
+
+ client := &http.Client{}
+
+ host := "localhost:" + env.Config.Port
protocol := "http://"
if env.Config.TLS.Certificate != "" || env.Config.TLS.Automatic {
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{
@@ -19,7 +23,18 @@ func RunPing() int {
protocol = "https://"
}
- resp, err := http.Get(protocol + "localhost:3000/_health")
+ req, err := http.NewRequest("GET", protocol+host+"/_health", nil)
+ if err != nil {
+ fmt.Printf("Setting up request failed with: %s", err)
+ return 1
+ }
+
+ // Set Host if HostDomain is set
+ if env.IsSingleHostMode() && len(env.Config.HostDomain) > 0 {
+ req.Host = env.Config.HostDomain
+ }
+
+ resp, err := client.Do(req)
if err != nil {
fmt.Printf("Request failed with: %s\n", err)
return 1