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.
- Accepted Answerasked 4 years ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated a year ago