Skip to content

Commit

Permalink
internal: restore /ping behaviour for embedded outpost (#11568)
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Langhammer <[email protected]>
  • Loading branch information
BeryJu authored Sep 30, 2024
1 parent 524f9ff commit dc1562a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion internal/outpost/proxyv2/proxyv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"net"
"net/http"
"strings"
"sync"

sentryhttp "github.com/getsentry/sentry-go/http"
Expand Down Expand Up @@ -70,12 +71,20 @@ func NewProxyServer(ac *ak.APIController) *ProxyServer {
}

func (ps *ProxyServer) HandleHost(rw http.ResponseWriter, r *http.Request) bool {
// Always handle requests for outpost paths that should answer regardless of hostname
if strings.HasPrefix(r.URL.Path, "/outpost.goauthentik.io/ping") ||
strings.HasPrefix(r.URL.Path, "/outpost.goauthentik.io/static") {
ps.mux.ServeHTTP(rw, r)
return true
}
// lookup app by hostname
a, _ := ps.lookupApp(r)
if a == nil {
return false
}
// check if the app should handle this URL, or is setup in proxy mode
if a.ShouldHandleURL(r) || a.Mode() == api.PROXYMODE_PROXY {
a.ServeHTTP(rw, r)
ps.mux.ServeHTTP(rw, r)
return true
}
return false
Expand Down

0 comments on commit dc1562a

Please sign in to comment.