I'm getting 400 Bad Request and "The specified bucket exists in another region. Please direct requests to the specified endpoint." when going to my domain: http://www.*.com/. I have the CNAME record on namecheap set to: .com.s3-website.us-east-2.amazonaws.com, which works fine when I type it in the browser. It seems like it's going to www..com.s3-website.us-east-2.amazonaws.com instead, (with the www added), because you get the same error if you type that into the address bar. I spoke with namecheap support, and he told me to change the CNAME host to # and delete the url redirect record because "it might be that the configuration of your website requires bare domain name not WWW". That didn't work. I also have namecheaps private email and he mentioned "your Email Service won't work if you have CNAME for the Root Domain". He told me to contact AWS support (I dont have tech support plan) and tell them to "Please contact your Hosting provider to change records from their side from Root Domain to www" and "you should change CNAME mapping from Root Domain to the WWW."
So I'm stumped here. Can anyone help me here? Is there a way to do what he said and will it fix my problem? Thanks.
This error means that you have configured the CNAME record in your DNS server to use the wrong S3 static web site endpoint.
Your CNAME is using us-east-2. In what region is the bucket located?
Go to the Amazon Console.
In S3 bucket properties, click on static web site hosting.
Copy the URL for your web site.
Go to your DNS Server.
Go to the record for www.
Make sure that the CNAME matches the static web site URL.
[EDIT after a series of comments]
If you create a bucket with the name www.hibachiandyou.com then the domain must exactly match the S3 bucket name. If you want to also have a the domain hibachiandyou.com, then you need another bucket with the exact same name. You cannot use DNS redirects to get from one to the other. Use any other convention and it will not work.
The domain apex (hibachiandyou.com) cannot be a CNAME. Amazon Route 53 supports using ALIAS records for the domain apex. I am not aware of any other DNS server that supports ALIAS records. Recommendation, move your DNS servers to Route 53.
You can use a redirect with S3 to redirect one static web site to another web site. Review section 2.3 in this link.
Setting up a Static Website Using a Custom Domain
Related
I've got 5 records in my AWS Route 53 hosted zone:
First is an NS for my domain name.
Second is SOA for that domain.
Third is a validated CNAME for it.
Fourth is cloudfront distribution A alias for it with the www prefix.
Fifth is validated CNAME for the www version.
I don't yet have an SSL attached to it.
It works - well partially.
Trying to reach the unprefixed version of the domain from Chrome doesn't work, but if I type the domain with the www prefix it works.
Firefox automatically redirects the unprefixed domain to the www variant. I type the unprefixed name making sure it's not redirecting because the prefixed name is in the search history. When I hit enter, Firefox automatically redirects to the www.
I'd like the main name to be accessible, not just the www one. It's OK if someone types the www. They should get to the site, but the actual name has no www.
I'm inexperienced enough not to be certain about that www prefix or why it is necessary. This was the result of a long course on AWS services.
Can anyone tell me if I'm missing a needed record, or if I'm improperly using the Alias A record?
Edited to add this below after reading first three answers. Thank all of you who answered for your responses. I do appreciate them. Please see my comments on those answers. --
I'm attaching a screenshot of my Route 53 hosted zone settings to maybe help you get a clearer picture of where I am.
Please remember. I'm not starting with a domain with a site that I wanted to host on S3 and then redirect www.mydomain traffic to mydomain.
I began coding an app with no domain. Then I uploaded it to an S3 bucket. I then was able to access it's simple S3 hosting with the ugly url. Then I used CloudFront for a world-wide distribution, again with an ugly url. Only then did I try taking one of my owned subdomains and redirecting it to Route 53. It wasn't as clean and simple as buying a domain from Amazon. I had no SSL and had to make a request for the AWS Certificate Manager to process validation of my domain. I got all that.
My problem is as I tried to explain - Chrome won't recognize or redirect my main domain name without the www. It only recognizes if one types the www. in front of the domain name. On the other hand, Firefox automatically redirects no matter what you type (the www version or the one without the www). That redirection is to the www version (that is what shows in the url bar in the end - http://www.mydomain).
I think I may have figured out most of this. As I mentioned in my comment above, I noticed I didn't have an Alias record for my main domain. I also read in AWS documentation that my S3 hosting bucket should have the same name as the domain, so I did that.
After creating the new original S3 hosting bucket I had made another to keep the log files. I set up a CloudFront Distribution. Then I requested and got SSL certificates for my owned domain name and added another for the www version. With those successfully enabled, I transferred my registered DNS servers to AWS. That created the NS and SOA records when I created my R-53 hosted zone. I then created Alias records for both the man and www version and added the validated SSL certificates for both the main domain and the www version. So, a total of six records in the zone.
I created my new S3 bucket, naming it the same as my domain; copied the settings from the old one, set it up to host static single page site and generate logs. I had already created a bucket for the logs, so I just pointed the logs location for the new domain named bucket. I gave the regular logs a log prefix (folder) and the CloudFront logs a cdn one.
Everything works great except I discovered a new problem. I'll post a new question regarding that, something like XML error on browser refresh in child pages.
Thanks ALL!
I have my domain registered and hosted at Hostpapa.
I have my web hosting in AWS S3. All set up as below:
Created a bucket in AWS S3 (named myDomain.org for example) with all the website content uploaded.
I'm able to access with URL like
http://myDOmain.org.s3-website.ca-central-1.amazonaws.com
The question is how do I point the domain in Hostpapa to AWS S3 website?
Thanks
The first thing to point out is that if you're trying to create a record for a root (or apex record) e.g. example.com you will need to ensure your domain service supports either ANAME or Alias records as traditionally only an A record (or AAAA for IPv6) will be supported for this record.
If your host supports one of these types (or is a subdomain e.g. subdomain.example.com in which case you can also use a CNAME record) you create the record and then use the CNAME provided as the value for your record.
If you are not able to configure in your current DNS provider, Route 53 does support Alias records so would be possible to add this for you.
It turns out straight forward.
In AWS S3
Create 2 buckets
myDomain.org
www.myDomain.org
Enable static web hosting in www bucket
Configure redirect for myDomain.org bucket to www
Upload website to www bucket
Copy www url (also called CNAME) like www.myDomain.org.s3-website.ca-central-1.amazonaws.com
In Hostpapa (or whatever the domain register)
Configure sub domain www to the above url (CNAME)
Wait couple of hours for propagation.
Works prefect!!!
I am trying to host my static website using S3. I have a domain that I bought outside of AWS. The URL for my bucker http://my-website.com.s3-website-us-east-1.amazonaws.com. My domain name is my-website.com. I have tried everything but I cannot wrap my head around how I should be configuring CNAME so that my URL does not look messed up. I tried forwarding but that does not work for obvious reasons.
Please suggest solutions.
It depends on what your DNS provider is
You're using Route53 then you need to go to the Hosted Zone for my-website.com and add a A record for my-website.com that points to the bucket. You must set Alias to true for this to work.
If you're using a different DNS provider you can't route Apex domain (my-wesite.com, without www, or another subdomain in front). You'll be able to add a CNAME record for a subdomain that points to the S3 web endpoint.
I am having trouble setting up DNS with Namecheap pointing to a static html website hosted in AWS S3.
Bucket config:
Currently, I get "chrisrich.io redirected you too many times."
This is the direct bucket url:
https://s3-ap-southeast-2.amazonaws.com/chrisrich.io/index.html
AWS S3 bucket name:
DNS settings in Namecheap:
What am I doing wrong?
There are two things:
The DNS record in Namecheap is for www.chrisrich.io and it's resolving to S3.
dig www.chrisrich.io +short
chrisrich.io.s3-ap-southeast-2.amazonaws.com.
s3-r-w.ap-southeast-2.amazonaws.com.
52.95.134.34
To make it work with www.chrisrich.io, you need to have the bucket name exact same name as www.chrisrich.io.
You can create a bucket with name www.chrisrich.io and put the files there , it should allow you to access your website using www.chrisrich.io.
You cannot have CNAME record for Apex domain chrisrich.io , it means you need to see if (URL forwarding) option available in Namecheap and chrisrich.io to www.chrisrich.io.
Also, Website endpoint doesn't support HTTPS, if you're planning to make your website work on https, you'll need cloudfront.
Also, to make S3 website endpoint work using www.chrisrich.io, you need to change your DNS record, currently you're using the REST API name for the CNAME record, chrisrich.io.s3.ap-southeast-2.amazonaws.com --> this should be the name of S3 website endpoint otherwise, index page won't load automatically and you will need to access it using www.chrisrich.io/index.html
You need to change your bucket name from chrisrich.io to www.chrisrich.io
Then, it will work.
Thanks
I have a static website hosted in S3 inside the bucket client1.examplecorp.com with a corresponding R53 record client1.examplecorp.com. A ALIAS s3-website-us-east-1.amazonaws.com.
I want my client's (client1.com) webadmin to create a dns record for the subdomain quotes.client1.com which will point to AWS (The client1.com does not use R53).
Should it point to client1.examplecorp.com ?
Or directly at the S3 bucket endpoint ?
The concept is that, the final user will see only the quotes.client1.com subdomain and not know about client1.examplecorp.com .
I hope I describe it well enough...
I have read the AWS docs about Setting Up a Static Website Using a Custom Domain , Virtual Hosting of Buckets and also this SO post.
I have a feeling that what I am searching for is described here How to redirect domains using Amazon Web Services .
I just do not understand how the registrar of the client will redirect traffic for that specific subdomain (quotes.client1.com) to client1.examplecorp.com by adding the 4 nameservers.
Moreover, will the redirect affect only this subdomain or the whole client1.com .
Finally, will it be completely transparent? Meaning that, the client1.examplecorp.com will not be shown to the end user?
I have not a firm grasp on explaining it , so please bear with me.
Here are two possible solutions:
In these examples, the client's main domain is example.com.
Option 1:
Create a bucket whose name is the same as the desired hostname, and have the client create a CNAME record pointing to the web site endpoint for the bucket.
Bucket name:
quotes.example.com
Web site endpoint (assuming us-east-1 region):
quotes.example.com.s3-website-us-east-1.amazonaws.com.
Client DNS:
quotes.example.com. CNAME quotes.example.com.s3-website-us-east-1.example.com.
The client does not need to be using Route 53 for their DNS, but the bucket name must exactly match the hostname they are pointing to the bucket, because that is how S3 works.
Option 2:
Send the traffic through CloudFront. In this scenario, the bucket name does not matter, because CloudFront will translate it to the correct bucket name.
Bucket name:
example-bucket
Web site endpoint:
example-bucket.s3-website-us-east-1.amazonaws.com
New CloudFront Distribution system-assigned hostname:
djozxyqkexample.cloudfront.net
CloudFront Origin (do not select the bucket name from the dropdown list, type in the S3 website hostname as shown in the S3 console):
example-bucket.s3-website-us-east-1.amazonaws.com
CloudFront alternate domain name:
quotes.example.com
Client creates a DNS CNAME
quotes.example.com. CNAME djozxyqkexample.cloudfront.net.
This solution also does not require that the client use Route 53, and -- importantly -- the bucket name does not need to match the hostname -- the hostname simply needs to be configured as a CloudFront alternate domain name so that CloudFront recognizes the Host: header when it arrives.
If you want to reuse the same bucket for multiple sites, you can add more hostnames to the CloudFront alternate domain name setting, or you can create multiple distributions pointing to the same bucket.
Note also that using CloudFront in front of S3 is effectively free, because S3 will no longer bill you for bandwidth when you use CloudFront -- instead, CloudFront will bill you for bandwidth, at the CloudFront rate, which is often slightly lower that the S3 rate.
In both cases, above, the client does not need to use Route 53, because they hostname in question is not the zone apex hostname (the "naked domain"). To use a naked domain with either solution requires Route 53, but that isn't applicable here.
Unfortunately, I think this is not possible. I am assuming that you own the corporation domain in this case.
For you to use client1.corporation.com, you had to use Route 53, right?
You also could not configure some DNS record in your other NameServer and do the same.
Similarly, for you to use quotes.client1.com point to the S3 bucket, you also need to ask the client use Route 53.
Hope that helped
Cheers!