Skip to content

adrienreveleau/static-router

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

CloudFront Static Router Function

A minimal CloudFront function for static sites.

Overview

  • Routing Logic:
    • Requests without an extension are rewritten:
      • /about/about.html
      • Unmatched cases default to /index.html
    • Requests with an extension (e.g., /sitemap.xml) remain unchanged.

Astro Configuration

To ensure proper URL rewriting, configure Astro to output files (not directories) by setting the following in your astro.config.mjs

export default defineConfig({
  build: {
    format: 'file',
  },
});