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

www -> root domain redirect Cloudfront clash #82

Open
vinnyt123 opened this issue Apr 27, 2021 · 0 comments
Open

www -> root domain redirect Cloudfront clash #82

vinnyt123 opened this issue Apr 27, 2021 · 0 comments

Comments

@vinnyt123
Copy link

vinnyt123 commented Apr 27, 2021

Following the tutorial for a www -> root domain redirect (e.g www.example.com -> example.com) https://serverless-stack.com/chapters/setup-www-domain-redirect.html, it directs you to set up a new cloudfront distribution for the www subdomain.

This means the www subdomain can no longer be an alternate domain name (CNAME) record for this cloudfront distribution or this error occurs on deploy:

Error: The domain "www.example.com" is already in use by another website or CloudFront Distribution.
    at updateCloudFrontDistribution (/var/task/utils.js:688:13)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

This is caused by

website/src/utils.js

Lines 103 to 104 in 6f87650

if (config.domain && config.domain === config.nakedDomain) {
config.domain = `www.${config.domain}`
automatically adding the www alternate domain name (CNAME) record when it is not wanted in this case.

I suggest an option should be added to not include this www alternate domain name (CNAME) for the cloudfront distribution as it makes this style of www redirect impossible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant