question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: How to redirect www to non-www with AWS

See original GitHub issue

With AWS, Can you guide me to redirect www to non-www to avoid duplicate content? Should we create a s3 bucket and a new Cloud front distribution? (https://www.pbxdom.com/how-redirect-non-www-to-www-with-amazon-cloud-front-route-53-and-s3)

or, can we set it up in the serverless.yml file?

Thanks!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
dphangcommented, Oct 7, 2020

I’ve released the PR: https://github.com/serverless-nextjs/serverless-next.js/pull/639 which can support this domain-level redirect in the Lambda@Edge itself. If you wish, you can try this method - please refer to the README for more details.

0reactions
dphangcommented, Oct 12, 2020

@pecoram it should be in 1.18.0-alpha.1. You can check the commit for the git tag for @sls-next/serverless-component https://github.com/serverless-nextjs/serverless-next.js/commit/a12e31ac06378f9fe26189b95a9b032942656380 (I know it’s a bit confusing with the many tags, we will work on improving the release changelogs soon).

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I redirect www to non-www in Route53? - Server Fault
Setup S3 with static website redirect to your non-www domain; Create a Cloudfront distibution to your S3 (using the S3 domain, not the...
Read more >
Redirecting non-WWW to WWW in AWS not working
I tried to set a redirection from a non-WWW domain to a WWW domain. For this thread, my domain is example.com . So...
Read more >
How to set up a root domain (non-www) in AWS Route 53
Step 1. From the Strattic dashboard, click the Details button, then click the Domain menu item, input your domain (without the www) and...
Read more >
Redirect www to non-www and HTTP to https in ... - Ly Channa
1. Use S3 + Cloudfront to capture the domain and redirect it to the primary domain. · 2. Modify the application server to...
Read more >
Route 53 redirect www to non-www? : r/aws - Reddit
You need a proper 301 permanent redirect. Route 53 alone cannot do this. Use the S3 bucket method you described. Point A Alias...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found