Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images are not returning an expires header #120

Closed
khalwat opened this issue Jul 12, 2019 · 7 comments
Closed

Images are not returning an expires header #120

khalwat opened this issue Jul 12, 2019 · 7 comments

Comments

@khalwat
Copy link

khalwat commented Jul 12, 2019

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?

@khawerrind
Copy link

Any update on this? @shsenior @hyandell

@blaineo
Copy link

blaineo commented Jul 26, 2019

I recently deployed this for our site and realized the same thing. Cache headers are not forwarded from S3. They were with the older Thumbor solution. In addition to the missing cache headers the content-type is simply set to 'image' instead of being more specific about the format.

@hayesry
Copy link
Member

hayesry commented Aug 4, 2019

Hey all - Thanks for bringing this issue to our attention, we're looking into it and hope to have an update for you soon!

@nxz91
Copy link

nxz91 commented Dec 5, 2019

Hey @hayesry any chance you'll merge this PR?

@abbasghulam
Copy link

Hey @hayesry any update on this please?

@deadmantfa
Copy link

#158

The pull request already exists can we have this merged

@beomseoklee
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants