@aligent/cdk-prerender-proxy 2.1.3 → 2.1.5
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.
|
@@ -7,9 +7,8 @@ export const handler = async (
|
|
|
7
7
|
const cacheKey = process.env.PRERENDER_CACHE_KEY || "x-prerender-requestid";
|
|
8
8
|
const cacheMaxAge = process.env.PRERENDER_CACHE_MAX_AGE || "0";
|
|
9
9
|
const response = event.Records[0].cf.response;
|
|
10
|
-
|
|
11
10
|
if (response.headers[`${cacheKey}`]) {
|
|
12
|
-
response.headers["
|
|
11
|
+
response.headers["cache-control"] = [
|
|
13
12
|
{
|
|
14
13
|
key: "Cache-Control",
|
|
15
14
|
value: `max-age=${cacheMaxAge}`,
|
|
@@ -37,8 +37,9 @@ export const handler = (
|
|
|
37
37
|
// Fetch default page and return body
|
|
38
38
|
return instance
|
|
39
39
|
.get(`https://${FRONTEND_HOST}${PATH_PREFIX}/index.html`)
|
|
40
|
-
.then(
|
|
41
|
-
|
|
40
|
+
.then(_res => {
|
|
41
|
+
// Commenting this as there is body is not defined in the CloudFrontResponse type
|
|
42
|
+
// response.body = res.data;
|
|
42
43
|
|
|
43
44
|
response.headers["content-type"] = [
|
|
44
45
|
{
|
|
@@ -52,7 +53,7 @@ export const handler = (
|
|
|
52
53
|
|
|
53
54
|
return response;
|
|
54
55
|
})
|
|
55
|
-
.catch(
|
|
56
|
+
.catch(_err => {
|
|
56
57
|
return response;
|
|
57
58
|
});
|
|
58
59
|
}
|
|
@@ -2,7 +2,7 @@ import "source-map-support/register";
|
|
|
2
2
|
import { CloudFrontRequest, CloudFrontRequestEvent } from "aws-lambda";
|
|
3
3
|
|
|
4
4
|
const IS_BOT =
|
|
5
|
-
/googlebot|Google-InspectionTool|chrome-lighthouse|lighthouse|adsbot-google|Feedfetcher-Google|bingbot|yandex|baiduspider|Facebot|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|quora link preview|showyoubot|outbrain|pinterest|slackbot|vkShare|W3C_Validator/i;
|
|
5
|
+
/googlebot|Google-InspectionTool|Schema-Markup-Validator|SchemaBot|chrome-lighthouse|lighthouse|adsbot-google|Feedfetcher-Google|bingbot|yandex|baiduspider|Facebot|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|quora link preview|showyoubot|outbrain|pinterest|slackbot|vkShare|W3C_Validator|AhrefsBot|SiteAuditBot|SemrushBot|Screaming Frog SEO Spider/i;
|
|
6
6
|
const IS_FILE =
|
|
7
7
|
/\.(js|css|xml|less|png|jpg|jpeg|gif|pdf|doc|txt|ico|rss|zip|mp3|rar|exe|wmv|doc|avi|ppt|mpg|mpeg|tif|wav|mov|psd|ai|xls|mp4|m4a|swf|dat|dmg|iso|flv|m4v|torrent|ttf|woff|svg|eot)$/i;
|
|
8
8
|
|