Skip to content
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

StaticSite: Add support for external domains #699

Merged
merged 8 commits into from
Aug 19, 2021
Merged

StaticSite: Add support for external domains #699

merged 8 commits into from
Aug 19, 2021

Conversation

warwickgrigg
Copy link
Contributor

Enhancement. As discussed on Slack. With documentation , a new test case, and two test cases updated. I've tested this e2e for my own hostname.

In brief, for external domains omit customDomain, and include:

cfDistribution: {
  domainNames: ["www.domain.com"],
  certificate: Certificate.fromCertificateArn(this, "MyCert", certArn)
}

Then set external domain's CNAME record to the cloudfront distribution's URL.

@fwang fwang added the enhancement New feature or request label Aug 16, 2021
@warwickgrigg
Copy link
Contributor Author

@fwang Thank you for moving this forward. Is the failed check a false negative, or do I need to fix something?

@thdxr thdxr requested a review from fwang August 18, 2021 13:55
@fwang
Copy link
Contributor

fwang commented Aug 19, 2021

Hey @warwickgrigg, I moved the code around a bit to rely on using the customDomain to configure external domains:

const site = new StaticSite(this, "Site", {
  path: "path/to/src",
  customDomain: {
    isExternalDomain: true,
    domainName: "domain.com",
    certificate: Certificate.fromCertificateArn(this, "MyCert", certArn),
  },
});

Behind the scene, it does exactly as what you proposed. This way, site.customDomainUrl still works.

Thanks again for working on the PR. This will go into the next release!

@fwang fwang merged commit e20420f into sst:master Aug 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants