Skip to content

Commit

Permalink
fix(route53-patterns): HttpsRedirect redirects to index.html
Browse files Browse the repository at this point in the history
The CloudFront distribution should not specify a default root object when
used as a redirect from one domain to another.

Specify an empty string since the CDK default is `index.html`.

See aws#5700 (comment) and aws#5700 (comment)
  • Loading branch information
jogold authored Apr 17, 2020
1 parent 999f936 commit 278fe29
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export class HttpsRedirect extends Construct {
removalPolicy: RemovalPolicy.DESTROY,
});
const redirectDist = new CloudFrontWebDistribution(this, 'RedirectDistribution', {
defaultRootObject: '',
originConfigs: [{
behaviors: [{ isDefaultBehavior: true }],
customOriginSource: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ test('create HTTPS redirect', () => {
});
expect(stack).toHaveResourceLike('AWS::CloudFront::Distribution', {
DistributionConfig: {
Aliases: ['foo.example.com', 'baz.example.com']
}
Aliases: ['foo.example.com', 'baz.example.com'],
DefaultRootObject: '',
},
});
expect(stack).toHaveResource('AWS::Route53::RecordSet', {
Name: 'foo.example.com.',
Expand Down

0 comments on commit 278fe29

Please sign in to comment.