title: How to configure CloudFront 403 redirection when hosting multiple Single Page Apps in one CloudFront Distribution and one S3 bucket origin
body: <p>My goal is to host a version of a website for every branch we have in Git. I have the following setup, which seems to work mostly as expected:</p>
  <ol>
  <li>S3 Bucket with a directory for each build</li>
  <li>A GitHub Actions job that builds the application when files change, and deploys the code to the appropriate directory in the S3 bucket</li>
  <li>A CloudFront distribution for websites that sits on top of the S3 bucket. It uses a wildcard certificate and a Lambda@Edge Viewer Request function that converts the subdomain of the request to the URI path (<a href="https://branch.dev.company.com/" rel="nofollow noreferrer">https://branch.dev.company.com/</a> -&gt; dev.company.com/branch/index.html). I needed to do this since the developers have written the application with redirects internally with absolute URIs.</li>
  </ol>
  <p>Normally for a single page app, I would set a custom 403 response to direct to /index.html Since I have multiple index.html pages in different places, I don't know how do direct that to the appropriate index.html. It feels like I need an option to redirect to %SITE_URL%/index.html</p>