diff --git a/director/director.go b/director/director.go index dc96131e3..b3915d55c 100644 --- a/director/director.go +++ b/director/director.go @@ -225,10 +225,13 @@ func generateXTokenGenHeader(ginCtx *gin.Context, namespaceAd server_structs.Nam hdrVals := []string{namespaceAd.Generation[0].CredentialIssuer.String(), fmt.Sprint(namespaceAd.Generation[0].MaxScopeDepth), string(namespaceAd.Generation[0].Strategy), basePath} - for idx, hdrKey := range []string{"issuer", "max-scope-depth", "strategy"} { + for idx, hdrKey := range []string{"issuer", "max-scope-depth", "strategy", "base-path"} { hdrVal := hdrVals[idx] if hdrVal == "" { continue + } else if hdrKey == "max-scope-depth" && hdrVal == "0" { + // don't send a 0 max-scope-depth because it's malformed and probably means there should be no token generation header + continue } if !first { tokenGen += ", " @@ -237,10 +240,6 @@ func generateXTokenGenHeader(ginCtx *gin.Context, namespaceAd server_structs.Nam tokenGen += hdrKey + "=" + hdrVal } - if basePath != "" { - tokenGen += ", base-path=" + basePath - } - if tokenGen != "" { ginCtx.Writer.Header()["X-Pelican-Token-Generation"] = []string{tokenGen} }