Skip to content

Commit e8f78f2

Browse files
authored
Forward proxy: Add health endpoint (#13)
1 parent 9b9c69e commit e8f78f2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

forward/forwardproxy.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"bufio"
1919
"bytes"
2020
"encoding/base64"
21+
"errors"
2122
"fmt"
2223
"io"
2324
"net"
@@ -96,6 +97,14 @@ func (cp *CoreProxy) Cleanup() error {
9697
return cp.policyManager.Stop()
9798
}
9899

100+
func (cp *CoreProxy) HandleHealthCheck(w http.ResponseWriter, r *http.Request) error {
101+
if r.Method != http.MethodGet {
102+
return utils.NewHandlerError(http.StatusMethodNotAllowed, errors.New("HTTP GET allowed only"))
103+
}
104+
w.WriteHeader(http.StatusOK)
105+
return nil
106+
}
107+
99108
func (cp *CoreProxy) HandlePolicyPath(w http.ResponseWriter, r *http.Request) error {
100109
return cp.policyManager.ServeHTTP(w, r)
101110
}

0 commit comments

Comments
 (0)