2

I have a static website w/ S3 + Route53 + Cloudfront set up. I am successfully able to do the following redirects:

http://example.com -> https://example.com

http://www.example.com -> https://example.com

https://example.com -> https://example.com (no redirect, but loads)

However, I see the following behavior:

https://www.example.com -> page never loads

Is there a way to make https://www.example.com -> https://example.com ?

Andrew
  • 121
  • 4

2 Answers2

1

It looks like there are multiple ways to do what you need. Are you trying to just make DNS records?

127.0.0.1 A example.com
127.0.0.1 A www.example.com

OR

127.0.0.1 A example.com
www.example.com CNAME example.com

There is a way to achieve what you mentioned using nginx or apache configuraion to run 301 requests for redirection. This is what you probably already achieved. Similar to https://thisinterestsme.com/php-forcing-https-over-http/

The problem might be related to the SSL certificate, it is crucial for HTTPS to display site requested, and not the one redirected from. Wildcard SSL might work with *.example.com, which will cover www.example.com.

Dmitriy Kupch
  • 471
  • 2
  • 6
0

I would just include the following DNS record in your Route53 configuration:

www IN CNAME example.com.
Dmitriy Kupch
  • 471
  • 2
  • 6