getlift / lift

Expanding Serverless Framework beyond functions using the AWS CDK
MIT License
912 stars 109 forks source link

When we have custom domain(s), always redirect to them #342

Open aran112000 opened 1 year ago

aran112000 commented 1 year ago

This ensures API Gateway and Cloudfront URLs all redirect to the primary domain - this helps prevent duplicating sites and getting them indexed across multiple hosts accidentally

mnapoli commented 1 year ago

Hi Aran, not sure I get this: the API Gateway URL will not invoke the CloudFront function, right?

aran112000 commented 1 year ago

Sorry, to explain more clearly, when we deploy a website with a custom domain, we end up with URLs for:

This PR would allow this option to redirect ALL hosts to the configured primary domain.

Without this, if a search engine managed to crawl these URLs, all of these versions would show the same content unless handled within the application logic (easy to forget and end up with nasty SEO implications as a result).

mnapoli commented 1 year ago

Ahh ok, I guess this would work for the cloudfront.net URL. But I meant it won't work for the API Gateway URL, right?

aran112000 commented 1 year ago

I was looking to solve Cloudfront initially and just thought (wrongly) this would just work with APIGW too, but of course not now I think through it properly.