Closed
Description
It appears that images coming from this solution do not have an Expires
header set; this means that after all this work we've done to deliver optimized images, the local browser can't leverage browser caching.
The headers seem to be set here:
const getResponseHeaders = (isErr) => {
const corsEnabled = (process.env.CORS_ENABLED === "Yes");
const headers = {
"Access-Control-Allow-Methods": "GET",
"Access-Control-Allow-Headers": "Content-Type, Authorization",
"Access-Control-Allow-Credentials": true,
"Content-Type": "image"
}
if (corsEnabled) {
headers["Access-Control-Allow-Origin"] = process.env.CORS_ORIGIN;
}
if (isErr) {
headers["Content-Type"] = "application/json"
}
return headers;
}
Most CDNs that I've worked with allow for pulling the Expires
header from the origin... and indeed, CloudFront can do this too.
However in our case, the origin is our Lambda function, not the S3 bucket... and this Serverless Image Handler solution doesn't appear to have the option of pulling down the Expires
header from the S3 bucket.
Think we can get this addressed?
Metadata
Metadata
Assignees
Labels
No labels