You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looking for c# sample code to add a new rule to an ALB listener that would check if the Host header contains a certain string before forwarding the request to a specific target group.
The following has been tried:
................
var alb = ApplicationLoadBalancer.FromLookup(scope, $"Get{props.ApplicationLoadBalancer}", new ApplicationLoadBalancerLookupOptions()
{
LoadBalancerArn = props.ApplicationLoadBalancer?.GetDescription()
});
if (alb == null)
{
throw new ArgumentException("Invalid Application Load Balancer provided.");
}
However the following error was received:
Unhandled exception. System.Exception: Error: .listeners can only be accessed if the class was constructed as an owned, not looked up, load balancer
I understand that this error could be due to the "from_lookup" method in the "elbv2.ApplicationLoadBalancer" class not currently being supported.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Looking for c# sample code to add a new rule to an ALB listener that would check if the Host header contains a certain string before forwarding the request to a specific target group.
The following has been tried:
................
var alb = ApplicationLoadBalancer.FromLookup(scope, $"Get{props.ApplicationLoadBalancer}", new ApplicationLoadBalancerLookupOptions()
{
LoadBalancerArn = props.ApplicationLoadBalancer?.GetDescription()
});
if (alb == null)
{
throw new ArgumentException("Invalid Application Load Balancer provided.");
}
alb.Listeners.First().AddTargetGroups($"{props.SiteUrl}LoadBalancerRule", new AddApplicationTargetGroupsProps()
{
Conditions = new ListenerCondition[] { ListenerCondition.HostHeaders(new string[] { $"{props.SiteUrl}.*" }) },
TargetGroups = new[] { targetGroup }
});
................
However the following error was received:
Unhandled exception. System.Exception: Error: .listeners can only be accessed if the class was constructed as an owned, not looked up, load balancer
I understand that this error could be due to the "from_lookup" method in the "elbv2.ApplicationLoadBalancer" class not currently being supported.
Looking for any suggestions/workarounds.
Beta Was this translation helpful? Give feedback.
All reactions