title: How serve the same file with dynamic URLs over a AWS CDN?
body: <p>I have a Angular App with a lot of routes, that run over a Express Server.</p>
  
  <p>Since all routes are from the same one-page-application, I configured Express the return always the same <code>index.html</code> for a bunch of routes, like <code>/login</code> and <code>/settings</code>. And I also have custom routes like <code>/user/:userId</code>.</p>
  
  <p>But since we remove our backend logic to a separated API, we plan to move our files into a Amazon CDN, CloudFront.</p>
  
  <p>But the thing is, CDN works like directories, there is a way to configure CloudFront to point all request <strong>without extension</strong> to return the <code>index.html</code>? Because that way all <code>.js</code> and <code>.css</code> would work nicely.</p>
  
  <p>I appreciate any help! Thanks.</p>
  
  <p><strong>Update 1</strong></p>
  
  <p>I did some more digging into Aws, and apparently this is more a S3 configuration than CloudFront. But I still don't know how to do this.</p>
  
  <p><strong>Update 2</strong></p>
  
  <p>I already found the answer in <a href="https://stackoverflow.com/questions/16267339/s3-static-website-hosting-route-all-paths-to-index-html">this stack</a>.</p>
  
  <p>The solution is tricky, I just had to configure all 404 errors (403 in the case of S3) to redirect to the <code>index.html</code> returning the status code 200, and all worked fine.</p>