Did you try to set a
default root object on CloudFront Distribution level?
It should do exactly what you want.
The object (file name) to return when a viewer requests the root URL (/) instead of a specific object.
Additionally, if you will really need a Function to fix this problem, you should consider using CloudFront Function instead of Lambda@Edge. It's cheaper and faster :) more you can find here.
OAI or not OAI for serving a static website in S3 using CloudFrontasked 8 months ago
CloudFront Distribution not serving S3 Bucket pages unless /index.html included in URLasked 10 months ago
S3 bucket blocking requestasked a month ago
s3 bucket loads content, cloudfront shows not found then loads content Gatsby projectasked 4 months ago
Help getting custom error pages from S3 into Cloudfront DistributionAccepted Answerasked 4 months ago
S3 pre signed url with block public access on a bucketAccepted Answerasked 3 years ago
Adding new S3 bucket to existing distributionasked a year ago
Lightsail S3 Bucket behind Lightsail Distributionasked 7 months ago
S3 Block Public Access + Bucket Policy - Access Deniedasked 8 months ago
Serving static site through CloudFrontAccepted Answerasked 5 months ago