Skip to content

Had issue in setup of a S3 + Cloudfront hosting the dist static website #28

Closed
@stouch

Description

@stouch

I setup my S3 with :
index.html as index and error file.

Then I setup my Cloudfront distribution with a Origin Request Lambda@Edge function (node20) like this :

import path  from 'path';
export const handler = async (event, context, callback) => {
  const { request } = event.Records[0].cf;
  const { uri, headers } = request;
  if (uri !== "" && uri !== "/" && !uri.includes('.')) {
      request.uri += '.html';
  }
  return request;
};

And everything worked then.

Thanks for your repo. Actually, it's insane that building a static site is not more obvious/straightforward when we're using react + vite project. Happily you made this repo 🔥 (I created a thread in react.dev about this last part : reactjs/react.dev#7155)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions