Skip to content

Commit

Permalink
Don't add /clusters/ prefix to /services/ requests
Browse files Browse the repository at this point in the history
Currently all requests from bound service accounts get `/clusters/`
prepended to the path in the front proxy with a few exeptions.  None of
those exceptions are for `/services/` requests.

With `/services/` requests prepended with `/clusters/`, the front proxy will
then route them to the KCP container instead of the virtual workspace
server.  KCP will remove the `/clusters/` prefix, create the logical
cluster context, and then try to redirect the `/services/` request to the
virtual workspace server.

Rinse and repeat until the client gives up.

This fix is to stop prepending `/clusters/` on requests to the virtual
workspace server.
  • Loading branch information
kylape authored and openshift-cherrypick-robot committed Jul 21, 2022
1 parent fe430c8 commit 29d24f4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/server/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@ func WithInClusterServiceAccountRequestRewrite(handler http.Handler) http.Handle
return
}

if strings.HasPrefix(req.RequestURI, "/services/") {
handler.ServeHTTP(w, req)
return
}

prefix := "Bearer "
token := req.Header.Get("Authorization")
if !strings.HasPrefix(token, prefix) {
Expand Down

0 comments on commit 29d24f4

Please sign in to comment.