ancient-match-5870
11/16/2018, 11:22 AMListenerRule
for a Load Balancer Listener on AWS. This is my current definition:
new aws.elasticloadbalancingv2.ListenerRule(`block-certain-routes`, {
listenerArn: listener.arn,
conditions: [{
field: "path-pattern",
values: ["/test1", "/test1"]
}],
actions: [{
type: "fixed-response",
fixedResponse: {
statusCode: 404,
contentType: "text/plain",
messageBody: "Not Found"
}
}]
}
});
I want to send a 404
whenever somebody requests certain paths. Unfortunately, the TS compiler complains with property apply is missing in type
on the conditions
and actions
attributes. Would be more than great if anybody can point me in the correct direction when it comes to defining a ListenerRule
🙂white-balloon-205
values
is actually a single string that represents a path pattern of values that will match the condition (e.g. it can use *
)
• statusCode
is a string, not a number
With those changes - the below looks like it should work:
new aws.elasticloadbalancingv2.ListenerRule(`block-certain-routes`, {
listenerArn: listener.arn,
conditions: [{
field: "path-pattern",
values: "/test1",
}],
actions: [{
type: "fixed-response",
fixedResponse: {
statusCode: "404",
contentType: "text/plain",
messageBody: "Not Found"
}
}]
});
The TypeScript errors are not being as helpful as they could be here unfortunately.ancient-match-5870
11/16/2018, 2:54 PMpath-pattern
twice (with different values). In this case you have to create to dedicated listener rules then.