fix api handler path

This commit is contained in:
mlsmaycon
2026-02-09 02:30:06 +01:00
parent 36cd0dd85c
commit 778c223176
4 changed files with 8 additions and 4 deletions

View File

@@ -84,7 +84,7 @@ func NewAPIHandler(ctx context.Context, accountManager account.Manager, networks
return nil, fmt.Errorf("failed to add bypass path: %w", err)
}
// OAuth callback for proxy authentication
if err := bypass.AddBypassPath(types.ProxyCallbackEndpoint); err != nil {
if err := bypass.AddBypassPath(types.ProxyCallbackEndpointFull); err != nil {
return nil, fmt.Errorf("failed to add bypass path: %w", err)
}

View File

@@ -7,6 +7,7 @@ import (
"github.com/coreos/go-oidc/v3/oidc"
"github.com/gorilla/mux"
"github.com/netbirdio/netbird/management/server/types"
log "github.com/sirupsen/logrus"
"golang.org/x/oauth2"
@@ -25,7 +26,7 @@ func NewAuthCallbackHandler(proxyService *nbgrpc.ProxyServiceServer) *AuthCallba
}
func (h *AuthCallbackHandler) RegisterEndpoints(router *mux.Router) {
router.HandleFunc("/oauth/callback", h.handleCallback).Methods(http.MethodGet)
router.HandleFunc(types.ProxyCallbackEndpoint, h.handleCallback).Methods(http.MethodGet)
}
func (h *AuthCallbackHandler) handleCallback(w http.ResponseWriter, r *http.Request) {

View File

@@ -1,4 +1,7 @@
package types
// ProxyCallbackEndpoint holds the proxy callback endpoint
const ProxyCallbackEndpoint = "/api/reverse-proxy/callback"
const ProxyCallbackEndpoint = "/reverse-proxy/callback"
// ProxyCallbackEndpointFull holds the proxy callback endpoint with api suffix
const ProxyCallbackEndpointFull = "/api" + ProxyCallbackEndpoint