AWS S3 Bucket Redirection redirects to a malformed URL
Asked Answered
D

1

8

I have followed the instructions that Amazon has provided for website hosting using s3 buckets here.

I have created two S3 buckets, one named MyWebsite.com and a second one named www.MyWebsite.com. In S3, I have configured the latter of the two buckets to redirect to the former, as shown in the example.

I am using Route53 to set Alias record sets for the www and non-www domain. My Record Sets are as follows:

Name: MyWebsite.com, Alias Target: s3-website-us-west-1.amazonaws.com.

Name: www .MyWebsite.com, Alias Target: s3-website-us-west-1.amazonaws.com.

Accessing the non-www domain, MyWebsite.com works fine, but when I try accessing www.MyWebsite.com, I am redirected to the invalid url:

http://http//MyWebsite.com.s3-website-us-west-1.amazonaws.com/

Where is the extra "http//" (without a colon) coming from and how can I prevent it?

Edit: Actual website name is thinkingdots.com

Disenable answered 6/9, 2017 at 14:54 Comment(6)
Can you let us know the domain name? It sounds like a DNS issue but I'm not positive.Classicism
Sure, my domain is thinkingdots.comDisenable
On my side it looks just fine - the www site does a 301 redirect to the non-www site. The non-www site sends a little bit of HTML. If it's still doing it for you then perhaps you have something cached in either the browser or in your DNS cache. Try to use an incognito browser window and/or wait for your DNS cache to expire.Classicism
Oh wow, you are right. It seems to be a caching issue, works fine in incognito... Thank you for taking a look at it though!Disenable
Wow! Caching issue. I was running around in circles for the last couple of hours on why things weren't working for me and going incognito worked fine. Thanks!Anchor
@Disenable caching was the issue even in 2024, this needs to be the answer for this post will save people a lot of timeOrdinarily
D
0

I'm not sure you actually need two s3 buckets here. I'm assuming you have a single deployment of the website on MyWebsite.com.s3-website-us-west-1.amazonaws.com/?

AWS has a constraint where the A record on Route53 for MyWebsite.com has to match the naming convention for the s3 bucket - which in this case is the "naked domain name" (i.e. no subdomain).

For www.MyWebsite.com, I believe you need to create a CNAME record on Route53 associating it with MyWebsite.com

Dwarfism answered 9/11, 2020 at 10:36 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.