I own a domain name in AWS Route 53 'www.derbyware.com', I have a web application running at 'http://node147934-env-7029269.phx.enscaled.us' on Jelastic. now for my users I want them to access the web application using www.derbyware.com not the ugly url 'http://node147934-env-7029269.phx.enscaled.us'. I successfully made www.derbyware.com act as the domain name for the web application. now non www 'derbyware.com' does not work.
you can test the urls.
This is the solution from AWS Support
Resolution:
Use the following procedure to redirect your domain. In this example, we redirect example.com to example.net.
Requirements:
- A hosted zone for the domain example.com is hosted in Amazon Route 53.
- You have permissions to add resource records to the hosted zone of example.com.
- You have permissions to create an Amazon S3 bucket.
- You are able to create an S3 bucket with the exact name for example.com.
Note: The sites must be HTTP, because the redirect cannot connect to S3 over HTTPS.
- In the Amazon S3 console, create an S3 bucket with the exact name as example.com.
Note: S3 bucket names must be globally unique. If the bucket name you need is already in use, this solution cannot be used.
- Choose the bucket you just created, and then choose Properties. Expand the Static Website Hosting dropdown menu, and then select Redirect all requests to another host name.
- In the Redirect all requests to another host name field, enter example.net and then choose Save.
- In the Route 53 console, select the hosted zone named example.com.
Create a resource record for example.com with the following values:
- Record Type: Choose A IPv4 address.
- Alias: Choose Yes.
- Alias Target: Select the blank value field, expand the drop down menu, and then choose your S3 bucket under header S3 Website Endpoints.
- Routing Policy: Choose Simple.
- Evaluate Health Target: Choose No and then choose Create. Note: The drop-down menu might take a few moments to populate your bucket name.
You should now be able to redirect example.com to example.net. You can confirm this by browsing to example.com or CURL to example.com. You should see "301 Moved Permanently" in your curl output, redirecting to example.net.
To clarify, it appears that your situation is:
- You have an existing web service running somewhere on the internet, that is accessible via a DNS name
- You have a domain name managed by Amazon Route 53 (eg
example.com
)
- You have successfully redirected requests sent to
www.example.com
to your existing web service
- You wish to also redirect
example.com
to your existing web service
Unfortunately, the specification for DNS on the Internet does not permit a CNAME
redirection on a top-level domain apex (eg example.com
). If you need to direct users to a DNS name, it is not possible. However, if you are able to redirect users to a specific IP address, then you could simply create an A
record at the domain apex, which would resolve example.com
to that IP address.
Amazon Route 53 has a special ability to permit redirection of a DNS apex record via an Alias
function. This can redirect traffic to:
- An Amazon Elastic Beanstalk environment
- An Amazon CloudFront distribution
- An Elastic Load Balancer
- An Amazon S3 bucket configured as a static website
Unfortunately, if your destination web service is not accessible via one of these methods, you will not be able to redirect the domain apex.
See: Choosing Between Alias and Non-Alias Resource Record Sets