Lambda @ Edge for Hugo site over S3/Cloudfront
1 min read
I rewrote it using the python runtime. After a bunch of debug sessions, I got it to work as expected. Here is the lambda code that I actually use for this now.
import json import re def lambda_handler(event, context): record = event["Records"] cf = record["cf"] request = cf["request"] uri = request["uri"] request["uri"] = re.sub("\/$", "/index.html", uri) return request
I hope it saves you all some time setting up the same thing. Now, no more python on this blog.