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

Comments: Set up WWW Domain Redirect #66

Closed
jayair opened this issue Apr 10, 2017 · 12 comments

Comments

Projects
None yet
4 participants
@jayair
Copy link
Member

commented Apr 10, 2017

@jayair jayair added the Discussion label Apr 10, 2017

@pjamieson

This comment has been minimized.

Copy link

commented Jul 3, 2017

Rather than create a second CloudFront Distribution, why not just add the alias www.[my-domain].com to the Route53 Record Sets for [my-domain]--pointing to the first distribution--then add www.[my-domain].com to that first distribution's Alternate Domain Names? That seems to work fine. Am I missing something?

@jayair

This comment has been minimized.

Copy link
Member Author

commented Jul 3, 2017

@pjamieson The reason we set up a redirect on our alternate domain is for SEO purposes. Not necessarily for ranking but because we don't want two versions of our domain active. By re-directing one (the www or apex domain) to the other we are telling the search engines to use one as opposed to both. I hope that makes sense.

@pjamieson

This comment has been minimized.

Copy link

commented Jul 3, 2017

Thanks, @jayair. That makes sense.

@jayair

This comment has been minimized.

Copy link
Member Author

commented Jul 3, 2017

@pjamieson Just added a small note to the chapter 9b67ea3.

@x11joe

This comment has been minimized.

Copy link

commented Nov 11, 2017

I'm getting the following error on this step, com.amazonaws.services.cloudfront.model.CNAMEAlreadyExistsException: One or more of the CNAMEs you provided are already associated with a different resource. (Service: AmazonCloudFront; Status Code: 409; Error Code: CNAMEAlreadyExists; Request ID: e21a6bde-c6d7-11e7-9415-837f645450a5), any ideas?

My bucket name is definitely different, so not sure...

@jayair

This comment has been minimized.

Copy link
Member Author

commented Nov 11, 2017

@x11joe This usually has to do with a CloudFront distribution having a CNAME already listed as the one you are trying to add. On which screen are you seeing this?

@x11joe

This comment has been minimized.

Copy link

commented Nov 11, 2017

I am seeing this on the part where you say ... Scroll down to the Alternate Domain Names (CNAMEs) and use the www version of our domain name here.

It shows up at the bottom, I'll try and get a screenshot.

....

Well... this is going to sound stupid but I tried just now and its working all the sudden?? Maybe this happened because I was doing test with the domain name prior on another serverless tutorial and it takes like 24 hours for it to remove it's self? Not sure. Maybe this post will help someone.

@jayair

This comment has been minimized.

Copy link
Member Author

commented Nov 11, 2017

@x11joe Yeah this can happen. Both the domain setting part and the CloudFront distributions take some time to apply their changes.

@johnnybigert

This comment has been minimized.

Copy link
Contributor

commented Nov 27, 2017

I just registered a domain (let's call it "mysite.com") and it shows the Notes app correctly. The s3 url and the cloudflare distribution url also show the Notes app. When trying to get the redirect from www.mysite.com to work, I get the following behavior:

http://www-xxx-notes-app-client.s3-website-us-east-1.amazonaws.com redirects correctly to mysite.com. However, http://www.mysite.com/ and xxx.cloudfront.net (which is the www cloudfront distribution url) both give

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
  <Code>AccessDenied</Code>
  <Message>Access Denied</Message>
  <RequestId>xxx</RequestId>
  <HostId>xxx</HostId>
</Error>

I have looked through the settings of the s3 redirect bucket, the www cloudfront distribution and the hosted zone record sets and they seem correct. Any ideas what to do?

@johnnybigert

This comment has been minimized.

Copy link
Contributor

commented Nov 27, 2017

I solved my problem: When I originally set up the the cloudfront distribution, I used the drop-down to chose the origin. The origin was then set to "www-xxx-notes-app-client.s3.amazonaws.com". However, when I went back to check the url for the s3 bucket, it is actually "www-xxx-notes-app-client.s3-website-us-east-1.amazonaws.com" (note the region!). Copying the correct url solved the problem. I'm curious to know if anyone have a guess why the drop-down gives me options that do not work...

@jayair

This comment has been minimized.

Copy link
Member Author

commented Nov 28, 2017

@johnnybigert Yeah I've come across this before. I really don't know why it is that way...

@jayair jayair closed this May 9, 2018

@jayair jayair reopened this May 9, 2018

@jayair

This comment has been minimized.

Copy link
Member Author

commented May 9, 2018

@jayair jayair closed this May 9, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.