Images are not returning an `expires` header
See original GitHub issueIt 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?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:12
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Images are not returning an expires header #120 - GitHub
It appears that images coming from this solution do not have an Expires header set; this means that after all this work we've...
Read more >Why doesn't the image include the "Expire" header?
All of Cloudinary delivered images have the correct expiration headers using the Cache-Control 'max-age' directive (which is the best practice ...
Read more >Chrome & Expires Header - Image Caching - Stack Overflow
In this case the browser will make no request at all to the server. In case the cached content is in-valid it will...
Read more >How to Add Expires Headers to WordPress (Detailed Guide)
In this article, we will be going through a detailed tutorial on how to add expires headers to your WordPress website, manually and...
Read more >Expires headers do not work - WordPress.org
Hello, 3w total cache does not establish an expiration date or a maximum age in the HTTP headers of some of the static...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @hayesry any update on this please?
We have updated our solution, and I believe your issue has been fixed. If you still see the issue with the latest version (v4.2), please feel free to reopen the issue.
You can refer to the recent changes here