Skip to content

Commit

Permalink
[ws-proxy] fix ACME challenge handler
Browse files Browse the repository at this point in the history
  • Loading branch information
sagor999 authored and roboquat committed Apr 19, 2022
1 parent f9c93c4 commit ede6cac
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions components/ws-proxy/pkg/proxy/workspacerouter.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ func HostBasedRouter(header, wsHostSuffix string, wsHostSuffixRegex string) Work
allClusterWsHostSuffixRegex = wsHostSuffix
}

// make sure acme router is the first handler setup to make sure it has a chance to catch acme challenge
setupAcmeRouter(r)

var (
getHostHeader = func(req *http.Request) string {
host := req.Header.Get(header)
Expand All @@ -64,8 +67,6 @@ func HostBasedRouter(header, wsHostSuffix string, wsHostSuffixRegex string) Work
ideRouter = r.MatcherFunc(matchWorkspaceHostHeader(allClusterWsHostSuffixRegex, getHostHeader, false)).Subrouter()
)

setupAcmeRouter(r)

r.NotFoundHandler = http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
hostname := getHostHeader(req)
log.Debugf("no match for path %s, host: %s", req.URL.Path, hostname)
Expand Down

0 comments on commit ede6cac

Please sign in to comment.