cdk-nuxt 2.18.1 → 2.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CloudFront function to redirect incoming requests to their corresponding S3 file.
|
|
3
|
-
*/
|
|
4
|
-
function handler(event) {
|
|
5
|
-
// Const and var are not supported
|
|
6
|
-
var request = event.request;
|
|
7
|
-
var uri = request.uri;
|
|
8
|
-
|
|
9
|
-
// The main entry point
|
|
10
|
-
if (uri === '/') {
|
|
11
|
-
request.uri = '/index.html';
|
|
12
|
-
return request;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// The path suffixes that shall redirect to the main entry point
|
|
16
|
-
var indexPathAliases = ['/', '/index.html']
|
|
17
|
-
for (var i = 0; i < indexPathAliases.length; i++) {
|
|
18
|
-
var alias = indexPathAliases[i];
|
|
19
|
-
if (uri.endsWith(alias)) {
|
|
20
|
-
var host = request.headers.host.value;
|
|
21
|
-
|
|
22
|
-
return {
|
|
23
|
-
statusCode: 301,
|
|
24
|
-
statusDescription: 'Moved Permanently',
|
|
25
|
-
headers:
|
|
26
|
-
{ "location": { "value": `https://${host}${uri.slice(0, -alias.length)}` } }
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// When the URI is missing a file extension, we assume the main entry file (index.html) for the current path is requested
|
|
32
|
-
if (!uri.includes('.')) {
|
|
33
|
-
request.uri += '/index.html';
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return request;
|
|
37
|
-
}
|