Skip to content
Merged
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
10 changes: 7 additions & 3 deletions cloudformation/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -849,11 +849,15 @@ Resources:
return request;
}

// Rewrite paths for the SPA, excluding /api and files with extensions
if (!uri.startsWith('/api') && !uri.includes('.')) {
request.uri = '/index.html';
// If the URI starts with /api/ and has a trailing slash, or includes a dot (is a file),
// let it pass through without modification.
// This ensures paths like /api/v1/data or /some/image.png are not rewritten.
if (uri.startsWith('/api/') || uri.includes('.')) {
return request;
}

// Rewrite and all other non-file paths to index.html for the SPA.
request.uri = '/index.html';
return request;
}

Expand Down
Loading