Skip to content

Commit

Permalink
Support proxy filter options
Browse files Browse the repository at this point in the history
  • Loading branch information
antoninbas committed Oct 30, 2020
1 parent b95e778 commit 276bd0e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pkg/antctl/raw/proxy/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,28 @@ func (o *proxyOptions) validateAndComplete() error {

o.port = defaultPort

if !strings.HasSuffix(o.staticPrefix, "/") {
o.staticPrefix += "/"
}

if !strings.HasSuffix(o.apiPrefix, "/") {
o.apiPrefix += "/"
}

if o.disableFilter {
if o.unixSocket == "" {
klog.Warning("Request filter disabled, your proxy is vulnerable to XSRF attacks, please be cautious")
}
o.filter = nil
} else {
o.filter = &proxy.FilterServer{
AcceptPaths: proxy.MakeRegexpArrayOrDie(o.acceptPaths),
RejectPaths: proxy.MakeRegexpArrayOrDie(o.rejectPaths),
AcceptHosts: proxy.MakeRegexpArrayOrDie(o.acceptHosts),
RejectMethods: proxy.MakeRegexpArrayOrDie(o.rejectMethods),
}
}

return nil
}

Expand Down

0 comments on commit 276bd0e

Please sign in to comment.