Hacker News new | ask | show | jobs
by soxocx 1473 days ago
> 4. Trying to get www.dontwordle.com and dontwordle.com to take you to the same URL (either www.dontwordle.com or dontwordle.com) and still support TLS and only use the tech I mentioned above. I actually still don’t have it working perfectly. I know of a solution, but it’s overly complicated

If you use Cloudfront with an S3 bucket as origin for _dontwordle.com_, just create a second Cloudfront with an S3 Bucket for _www.dontwordle.com_ and enable "static website hosting" to redirect to "dontwordle.com" on the second bucket.

1 comments

So you can do this, but it won't support TLS to my knowledge. At least in my testing, it will work to navigate to www.dontwordle.com (you will get redirected to https://dontwordle.com). However, if you tried navigating _directly_ to https://www.dontwordle.com, that would not work. In fact, you can try clicking on https://www.dontwordle.com right now, and it won't work :) To be fair, currently I do not have it implemented exactly the way you described, but I encountered this exact same behavior when I tried it that way
Yup, been there. Have a look to see if cloudflare will do what you need within the free plan. You just point it at the bucket, add a rule for the redirect and all the tls is handled for you. It’s pretty painless. Feel free to ping me if you want to run through the steps.
I use the setup described.

It was some tinkering around with bucket name (has to match the subdomain.domain.tld) and the cloudfront origin settings. But it works flawlessly. Feel free to ping me if you need details.

See links below.

coindex.de www.coindex.de

Could try serving a client side redirect. Just an index.html page that has a script that redirects the browser to the https version

    <script>document.location.href = https://dontwordle.com</script>
Assuming that works, I don't see the need for Javascript when a meta refresh achieves the same with just HTML.
Well the game needs JavaScript to run anyway so...

Haven't heard of meta refresh though, thanks for sharing