-
Notifications
You must be signed in to change notification settings - Fork 653
Description
Hello! I'm having trouble setting the cache-control max-age header for images in my storage bucket.
The images are actually stored in a firebase storage bucket, I'm not sure if that should make any difference.
I can successfully upload an image receive the file object in the response. I then set the cache-control max-age header for the file to 31536000.
When I visit the image at the public url (https://storage.googleapis.com/my-bucket-name.appspot.com/path/to/image.png) the cache-control max-age header is set to 3600, which is the default.
Oddly enough if I visit the public url over http (http://storage.googleapis.com/my-bucket-name.appspot.com/path/to/image.png) the cache-control max-age header is set to 31536000, as expected.
How can I set this header for the public url available over https? Thanks for any help!
Environment details
- OS: Mac 10.12.3
- Node.js version: 6.9.1
- google-cloud-node version: 0.46.2
Steps to reproduce
const gcloud = require('google-cloud');
const gcs = gcloud.storage({credentials: myCredentials});
const storageBucket = gcs.bucket(myConfig);
storageBucket.upload('path/to/image', {
public: true,
destination: storageBucket.file('storageBucketName/imageName.png')
} , (err, file, apiResponse) => {
file.setMetadata({
cacheControl: 'public, max-age=31536000'
});
});