-
Notifications
You must be signed in to change notification settings - Fork 4.3k
feat(elasticloadbalancingv2): transforms for ALB listener rule #35906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This review is outdated)
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
| */ | ||
| @MethodMetadata() | ||
| public addAction(id: string, props: AddApplicationActionProps): void { | ||
| checkAddRuleProps(this, props); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because checkAddRuleProps() cannot accept transforms prop, I've added new validation function checkAddActionProps().
| } | ||
|
|
||
| private validateRewrites(rewrites: RewriteRule[]): void { | ||
| if (rewrites.length !== 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In CloudFormation, an array of rewrite rules can be configured, but currently, deploying with multiple rules results in an error.
To prepare for future enhancements, the parameter is defined to accept an array, while validation restricts the number of elements to one.
transforms: [
elbv2.ListenerTransform.hostHeaderRewrite([
{
regex: '^(.*)\\.example\\.com$',
replace: '$1.internal.example.com',
},
{
regex: '^(.*)$',
replace: 'internal.example.com',
},
]),
],Resource handler returned message: "Rule transforms must have exactly one Rewrite (Service: ElasticLoadBalancingV2, Status Code: 400, Request ID: c2ecd108-daad-4c23-bc38-0c5b1348d04a) (SDK Attempt Count: 1)" (RequestToken: d66a6b69-d5c8-2d95-a439-4f422e5905c9, HandlerErrorCode: InvalidRequest)
Issue # (if applicable)
None
Reason for this change
ALB now supports for modifying host header and URL information. This feature has already supporrted by cloudformation.
https://docs.aws.amazon.com/ja_jp/elasticloadbalancing/latest/application/rule-transforms.html
Description of changes
ListenerTransformclass with factory methods:hostHeaderRewrite(): Transform host headers using regexpatterns
urlRewrite(): Transform URL paths using regex patternsAddApplicationActionPropsaddTransform()method toApplicationListenerRulerule
Describe any new or updated permissions being added
None
Description of how you validated changes
Add both unit and integ tests.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license