-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
feat(route53): Domain redirect pattern #3946
Conversation
This is currently work-in-progress but I wanted to get feedback early in the process. |
Pull Request Checklist
|
Codebuild (Continuous Integration) build failed for current commits. Please check log and resolve before PR is merged. |
* The domain name | ||
* | ||
* @default - the domain name of the zone | ||
*/ |
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.
Should this only be a subdomain? Will this also support redirecting the root domain?
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.
Perhaps call it recordName to align with route53 terminology? Provide an @example
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.
@hoegertn what do you think?
originConfigs: [{ | ||
behaviors: [{ isDefaultBehavior: true }], | ||
customOriginSource: { | ||
domainName: Fn.select(2, Fn.split('/', redirectBucket.bucketWebsiteUrl)), |
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.
Are you sure there isn’t an attribute for this already?
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.
I presume that this is to remove the http://
from the website url attribute
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.
Wouldn't that be redirectBucket.bucketDomainName
?
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.
bucketDomainName
points to the REST API endpoint, not the website endpoint. The REST API endpoint doesn't support redirects.
mystack-mybucket-kdwwxmddtr2g.s3.amazonaws.com
vs http://mystack-mybucket-kdwwxmddtr2g.s3-website-us-east-2.amazonaws.com/
https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteEndpoints.html#WebsiteRestEndpointDiff
@hoegertn may be add a comment explaining this line.
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.
the bucketDomainName is the name for S3 operations but not the website domain
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.
Should we simply add another attribute to s3.Bucket
? Sounds like something others can benefit from...
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.
@hoegertn care to raise an issue (and make sure to reference this usage so we can track it down).
This library contains commonly used patterns for Route53: | ||
* HTTP Redirect | ||
```ts | ||
new HTTPSRedirect(stack, 'Redirect', { |
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.
Should be called HttpsRedirect
|
||
This library contains commonly used patterns for Route53: | ||
* HTTP Redirect | ||
```ts |
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.
Provide some details about what this construct does and a glimpse to the underlying implementation in a sentence.
@rix0rrr what do you think about the module? Does it make sense to file this under "route53"? I am not 100% convinced. |
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.
I think we should offer a way to redirect multiple domains to the same target domain: domain.com -> www.domain.com
, domain.net -> www.domain.com
, domian.com -> www.domain.com
This can be achieved using a single CloudFront distribution with multiple alternate domain names (and multiple S3 buckets and A records).
<!--END STABILITY BANNER--> | ||
|
||
This library contains commonly used patterns for Route53: | ||
* HTTP Redirect |
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.
* HTTP Redirect | |
* HTTPS Redirect |
*/ | ||
readonly domainName?: string; | ||
/** | ||
* The ARN of the certificate; Has to be in us-east-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.
* The ARN of the certificate; Has to be in us-east-1 | |
* The ACM certificate; Has to be in us-east-1 |
originConfigs: [{ | ||
behaviors: [{ isDefaultBehavior: true }], | ||
customOriginSource: { | ||
domainName: Fn.select(2, Fn.split('/', redirectBucket.bucketWebsiteUrl)), |
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.
I presume that this is to remove the http://
from the website url attribute
Codebuild (Continuous Integration) build failed for current commits. Please check log and resolve before PR is merged. |
Update ALL jsii dependencies to 0.16, instead of just the "jsii" tool proper.
Bumps [@types/semver](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/semver) from 6.0.1 to 6.0.2. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/semver) Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Bumps [aws-sdk](https://github.com/aws/aws-sdk-js) from 2.522.0 to 2.524.0. - [Release notes](https://github.com/aws/aws-sdk-js/releases) - [Changelog](https://github.com/aws/aws-sdk-js/blob/master/CHANGELOG.md) - [Commits](aws/aws-sdk-js@v2.522.0...v2.524.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
…3914) * fix(certificatemanager): add minimum backoff Add a minimum component to the backoff and retry timer * fix(certificatemanager): stub out sleep Provide stub function for sleep to allow long running sleep to cause test to fail * fix(certificatemanager): spy on sleep spy on sleep function to determine total time attempted to sleep * fix(certificatemanager): Failing test Failing test demonstrating min sleep is as low as 4.6 seconds. * fix(certificatemanager): increase attempts Increase max attempts in validation, still under 10, but such that minimum sleep duration of one minute is reached (but not more than 3 minutes). Can adjust tests if window is not suitable, but I find that at least 30 seconds is needed in my region
Removes the dependabot autolabeling functionality (unnecessary and confusing)
Codebuild (Continuous Integration) build failed for current commits. Please check log and resolve before PR is merged. |
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.
There are still some unaddressed/unresolved comments.
## HTTPS Redirect | ||
|
||
This construct allows creating a simple HTTP->HTTPS and domainA->domainB redirect using CloudFront and S3. | ||
|
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.
Add an snippet on how to create an HTTP=>HTTPS redirect. It's not clear from this.
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.
I will reword this sentence. It is doing a domain redirect and http->https redirect for domainA. You cannot use this construct to redirect http->https on your app domain, as you can only have of DNS entry for your domain.
originConfigs: [{ | ||
behaviors: [{ isDefaultBehavior: true }], | ||
customOriginSource: { | ||
domainName: Fn.select(2, Fn.split('/', redirectBucket.bucketWebsiteUrl)), |
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.
Should we simply add another attribute to s3.Bucket
? Sounds like something others can benefit from...
|
||
```ts | ||
new HttpsRedirect(stack, 'Redirect', { | ||
domainName: 'foo.example.com', |
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 is now recordNames
Any updates here? |
We had AWS Community Days in Germany and I did not have time. Will try to fix it tonight. |
No worries. Just checking in. No rush of course. |
Continuous integration build failed |
@eladb Something strange is happening on build. If I remove the dependency in |
Thanks so much for taking the time to contribute to the AWS CDK ❤️ We will shortly assign someone to review this pull request and help get it
|
Seems like your
|
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
This implements an HTTPS redirect using a CloudFront distribution and an S3 bucket. (fix #3893)
This implements an HTTPS redirect using a CloudFront distribution and an S3 bucket. (fix #3893)
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license