Cache Control & s3Up.signUpload
Gorbus opened this issue · comments
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.
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.
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 :)
@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.
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.