- Update CloudFront Function to handle Next.js static export .html files - Fix TypeScript interface for color request service (add required user_phone field) - Update ColorRequestForm component to include phone field
19 lines
503 B
JavaScript
19 lines
503 B
JavaScript
function handler(event) {
|
|
var request = event.request;
|
|
var uri = request.uri;
|
|
|
|
// Check whether the URI is missing a file extension
|
|
if (!uri.includes('.')) {
|
|
// Check if URI ends with /
|
|
if (uri.endsWith('/')) {
|
|
request.uri += 'index.html';
|
|
} else {
|
|
// For Next.js static export, try .html first
|
|
// CloudFront will handle 404s via custom error response
|
|
request.uri += '.html';
|
|
}
|
|
}
|
|
|
|
return request;
|
|
}
|