Skip to content

Commit

Permalink
Add option to disable authorization header for forwarded requests
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipAB committed Sep 18, 2024
1 parent cd04bba commit 890ac36
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions v3/pkg/shell/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,16 @@ type ShellProxy struct {
}

type Service struct {
Name string `json:"name"`
HasWebinterface bool `json:"hasWebinterface"`
Port int `json:"port"`
Path string `json:"path"`
Protocol string `json:"protocol"`
HasOwnTab bool `json:"hasOwnTab"`
NoRewriteRootPath bool `json:"noRewriteRootPath"`
RewriteHostHeader bool `json:"rewriteHostHeader"`
RewriteOriginHeader bool `json:"rewriteOriginHeader"`
Name string `json:"name"`
HasWebinterface bool `json:"hasWebinterface"`
Port int `json:"port"`
Path string `json:"path"`
Protocol string `json:"protocol"`
HasOwnTab bool `json:"hasOwnTab"`
NoRewriteRootPath bool `json:"noRewriteRootPath"`
RewriteHostHeader bool `json:"rewriteHostHeader"`
RewriteOriginHeader bool `json:"rewriteOriginHeader"`
DisableAuthorizationHeader bool `json:disableAuthorizationHeader`
}

var sshDev = ""
Expand Down Expand Up @@ -313,6 +314,10 @@ func (sp ShellProxy) proxy(w http.ResponseWriter, r *http.Request, user *userpb.
r.Out.Header.Set("Origin", target)
}

if hasService && service.DisableAuthorizationHeader {
// Remove Authorization header if present
r.Out.Header.Del("Authorization")
}
},
}
proxy.Transport = &http.Transport{
Expand Down

0 comments on commit 890ac36

Please sign in to comment.