Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 1
    Your code example misses just a line: return callback(null, request); Commented Apr 15, 2020 at 10:28
  • 1
    This is the right answer for 2020 onwards Commented Feb 27, 2021 at 23:04
  • My lambda@Edge is never called, do i need extra role permission? Commented Jul 25, 2021 at 23:30
  • This is the right way. Just the regex at the replace i think should be like this: var newuri = olduri.replace(/\/.+$/, '\/index.html'); Commented Jul 26, 2021 at 0:34
  • 2
    I provided an answer below which uses Cloudfront Functions (part of the AWS free tier). Commented Oct 20, 2021 at 20:41