1

We use an S3 bucket and Route 53 alias record to redirect domain.com to www.domain.com on a DNS level. This works with http, but does not work with https requests. There are TXT and MX records for domain.com, so we cannot use a CNAME. The www.domain.com is a CNAME to our Elastic Beanstalk server. The domain.com cannot be an A record since the server's IP address is not fixed. What works:

What does not work:

  • curl https://domain.com => curl: (7) Failed connect to domain.com:443; Connection refused

How to redirect https://domain.com to https://www.domain.com? Or alternatively what should we do with the TXT and MX records so we can use a CNAME record?

Community
  • 1
  • 1
user3145800
  • 203
  • 1
  • 7
  • Instead of pointing `domain.com` to an Amazon S3 bucket for redirect, can you use the Route 53 `ALIAS` function to point to the Elastic Load Balancer that was created by Elastic Beanstalk? See: [Mapping Domain Names with name.com, Elastic Beanstalk, Elastic Load Balancer and AWS Route 53](http://compositecode.com/2014/01/23/mapping-domain-names-w-name-com-and-amazon-route-53/) – John Rotenstein Sep 21 '15 at 03:47
  • No, because we use a single instance EB server for our website. There is no need for a load balancer since a single instance can easily serve the traffic. Single EB instances are not listed in Route 53 `ALIAS`. – user3145800 Sep 21 '15 at 04:40
  • 1
    This is the old "DNS apex cannot contain a CNAME" problem. Amazon Route 53 solves it by allowing apex domains (eg `domain.com`) to point to Elastic Load Balancers, Amazon S3 websites and other DNS entries. Then, `www.domain.com` could be redirected to `domain.com`. However, your situation is the reverse, with `domain.com` pointing at `www.domain.com`. The redirect through S3 then doesn't work with `HTTPS` because it's *your* certificate. How about having your application update a Route 53 `A` record when it boots up, so the domain always points to the right instance? – John Rotenstein Sep 21 '15 at 11:10
  • in my case i have pointed cname and the domain https://example.com not working however http://example.com working fine please suggest me how i can make working https://example.com. – Ramesh Chand Aug 23 '17 at 06:12

0 Answers0