Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

EdgeAngular - A Lambda@Edge Function for URI rewriting in Angular Applications

A Lambda, executed upon CloudFront's "Origin Request" behaviour, to re-write requests for Angular Applications, where an existing file qualification has not been supplied.

EdgeAngular Sequence Diagram


A CloudFronted-S3 Bucket will not be able to route Angular requests correctly to /index.html. This Lambda@Edge Function rewrites Angular URI paths against /index.html.


  1. Create a new Lambda Function, using the latest version of Node.js (I used 10.x at the time of writing);
  2. Ensure the Lambda can execute at with the required permissions. I use the following policy via IAM:
        "Version": "2012-10-17",
        "Statement": [
                "Effect": "Allow",
                "Action": [
                "Resource": [
  3. Deploy a new version to Lambda@Edge;
  4. Configure "Origin Request" Behaviour to call ARN of Lambda, with the current version;
  5. Browse to your resource(s) using SEO-optimised URIs.


Thanks to Richard Lund for the debugging & refactoring.


All yours. MIT License. Do what you will, at your own risk!

You can’t perform that action at this time.