9
votes

I tried to set Cache-Control header for Google Cloud Storage bucket. It gives me 400: Invalid argument error without any explanation what exactly wrong. Any ideas?

Example:

gsutil setmeta -R -h 'Cache-Control:public, max-age=10000, no-transform' gs://example.com/stylesheets/

Setting metadata on gs://example.com/stylesheets/site-77ee6060.css BadRequestException: 400 Invalid argument

Tried with different max-age, with or without no-transform, same result. bucket is configured as website.

1
The Cache-Control parameters you're using are valid, and I was able to run the command above (with a collection of objects I own) successfully. Can you please send the output of the following command to [email protected], removing Authorization headers: gsutil -D setmeta -R -h 'Cache-Control:public, max-age=10000, no-transform' gs://example.com/stylesheets/ - Mike Schwartz
@MikeSchwartz I sent debug info to [email protected] - Ivan Tarapon
@MikeSchwartz I am also have this issue happening on some of my files. Would it be helpful for me to send my output to the same address? - CVAUGHN
@MikeSchwartz - Does Google have any feedback on this issue? I'm seeing the same problem with Content-Type - UpTheCreek
No, no feedback. After some time we decided to not use it anymore - Ivan Tarapon

1 Answers

2
votes

I had this issue, and discovered that I did not have OWNER permission on the object anymore (someone else on my team had edited the object).