handle default ports

This commit is contained in:
pascal
2026-02-09 18:15:26 +01:00
parent 7c14056faf
commit 16d1b4a14a
2 changed files with 18 additions and 5 deletions

View File

@@ -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,