mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-20 17:26:40 +00:00
handle default ports
This commit is contained in:
@@ -1923,7 +1923,7 @@ func (a *Account) GetResourcesMap() map[string]*resourceTypes.NetworkResource {
|
||||
return resourcesMap
|
||||
}
|
||||
|
||||
func (a *Account) InjectProxyPolicies() {
|
||||
func (a *Account) InjectProxyPolicies(ctx context.Context) {
|
||||
if len(a.ReverseProxies) == 0 {
|
||||
return
|
||||
}
|
||||
@@ -1943,6 +1943,19 @@ func (a *Account) InjectProxyPolicies() {
|
||||
continue
|
||||
}
|
||||
|
||||
port := target.Port
|
||||
if port == 0 {
|
||||
switch target.Protocol {
|
||||
case "https":
|
||||
port = 443
|
||||
case "http":
|
||||
port = 80
|
||||
default:
|
||||
log.WithContext(ctx).Warnf("unsupported protocol %s for proxy target %s, skipping policy injection", target.Protocol, target.TargetId)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
policyID := fmt.Sprintf("proxy-access-%s-%s", service.ID, proxyPeer.ID)
|
||||
a.Policies = append(a.Policies, &Policy{
|
||||
ID: policyID,
|
||||
|
||||
Reference in New Issue
Block a user