Skip to content

Commit

Permalink
Allow overriding Host configuration in HTTP checks
Browse files Browse the repository at this point in the history
  • Loading branch information
mcorbin committed Jun 30, 2023
1 parent 72c0297 commit d276abe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20-1-buster as build-env
FROM golang:1.20.5-bullseye as build-env

ADD . /app
WORKDIR /app
Expand Down
4 changes: 2 additions & 2 deletions docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

version=$1

docker build -t mcorbin/cabourotte:${version} .
docker push mcorbin/cabourotte:${version}
docker build -t appclacks/cabourotte:${version} .
docker push appclacks/cabourotte:${version}
4 changes: 4 additions & 0 deletions healthcheck/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type HTTPHealthcheckConfiguration struct {
ValidStatus []uint `json:"valid-status" yaml:"valid-status"`
// can be an IP or a domain
Target string `json:"target"`
Host string `json:"host,omitempty"`
Method string `json:"method"`
Port uint `json:"port"`
Redirect bool `json:"redirect"`
Expand Down Expand Up @@ -233,6 +234,9 @@ func (h *HTTPHealthcheck) Execute() error {
if h.Config.Redirect {
redirect = nil
}
if h.Config.Host != "" {
req.Host = h.Config.Host
}
client := &http.Client{
Transport: h.transport,
CheckRedirect: func(req *http.Request, via []*http.Request) error {
Expand Down

0 comments on commit d276abe

Please sign in to comment.