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

Cache Control & s3Up.signUpload #16

Open
Gorbus opened this issue Dec 9, 2020 · 4 comments
Open

Cache Control & s3Up.signUpload #16

Gorbus opened this issue Dec 9, 2020 · 4 comments

Comments

@Gorbus
Copy link

Gorbus commented Dec 9, 2020

Hello,

We are using the library and like it a lot. However I don't manage to set up Cache Control when using the signUpload on Server Side. I have tried the following but doesn't seem to be working:

    return s3Up.signUpload({
      key,
      fields: {
        ContentType: fileType,
        CacheControl: "max-age=31536000",
      },
    });

Thanks in advance for your feedback.

@Lepozepo
Copy link
Owner

Lepozepo commented Dec 9, 2020

Hmm, maybe ['response-cache-control']: 'max-age=31536000'? Not too sure though. Are you trying to get S3 to respond with those cache control settings for that particular object? If so, you might need to use a different strategy. I think you'd upload the file normally but when someone fetches the file you'll be forced to use a presigned GET URL instead that specifically sets that cache control response in its signature per S3's docs.

image

@Gorbus
Copy link
Author

Gorbus commented Dec 10, 2020

I mainly want the file to be cached, not sure what's the best approach :D

To have the same result as this:

./s3cmd --recursive modify --add-header="Cache-Control:max-age=86400" s3://yourbucket/

but not having to do this after any upload :)

@Lepozepo
Copy link
Owner

@Gorbus I'll look into it further over the weekend ^_^ if you by any chance find a way to do it through this package, I'd greatly appreciate the feedback and I can try to abstract it.

@Gorbus
Copy link
Author

Gorbus commented Dec 11, 2020

Thanks for having a look.

Tried a lot of things but somehow nothing seemed to have worked so I hope you'll find a way during the weekend.

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

2 participants