Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ jobs:
if: ${{ env.DOCS_S3_BUCKET != '' }}
run: |
aws --region ${{ env.DOCS_AWS_REGION }} s3 sync \
--acl public-read \
--delete \
--exclude "*" \
--include "*.webp" \
Expand All @@ -109,7 +108,6 @@ jobs:
--content-type="image/webp" \
public s3://${{ env.DOCS_S3_BUCKET }}/
aws --region ${{ env.DOCS_AWS_REGION }} s3 sync \
--acl public-read \
--delete \
--exclude "*.webp" \
public s3://${{ env.DOCS_S3_BUCKET }}/
Expand Down
17 changes: 17 additions & 0 deletions hack/releaser/cloudfront-lambda-redirects.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,22 @@ exports.handler = (event, context, callback) => {
return
}

// Handle directory requests by appending index.html for requests without file extensions
let uri = request.uri;

// Check if the URI has a dot after the last slash (indicating a filename)
// This is more accurate than just checking the end of the URI
const hasFileExtension = /\.[^/]*$/.test(uri.split('/').pop());

// If it's not a file, treat it as a directory and append index.html
if (!hasFileExtension) {
// Ensure the URI ends with a slash before appending index.html
if (!uri.endsWith("/")) {
uri += "/";
}
uri += "index.html";
request.uri = uri;
}

callback(null, request);
};