proxy: implement simple healthcheck

This commit is contained in:
Jens Langhammer 2020-09-19 11:43:22 +02:00
parent 77842fab58
commit 4af563ce89
3 changed files with 9 additions and 2 deletions

View File

@ -7,6 +7,10 @@ COPY . .
RUN go build -o /work/proxy .
# Copy binary to alpine
FROM gcr.io/distroless/base-debian10
FROM gcr.io/distroless/base-debian10:debug
COPY --from=builder /work/proxy /
HEALTHCHECK CMD [ "wget", "spider", "http://localhost:4180/pbprox/ping" ]
ENTRYPOINT ["/proxy"]

View File

@ -47,7 +47,6 @@ func getCommonOptions() *options.Options {
commonOpts.EmailDomains = []string{"*"}
commonOpts.ProviderType = "oidc"
commonOpts.ProxyPrefix = "/pbprox"
commonOpts.PingPath = "/pbprox/ping"
commonOpts.SkipProviderButton = true
commonOpts.Logging.SilencePing = true
commonOpts.SetXAuthRequest = true

View File

@ -82,6 +82,10 @@ func (s *Server) ServeHTTPS() {
}
func (s *Server) handler(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/pbprox/ping" {
w.WriteHeader(204)
return
}
handler, ok := s.Handlers[r.Host]
if !ok {
// If we only have one handler, host name switching doesn't matter