Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Content-Security-Polisy header for images from Google Cloud Storage

Hello,

We want to use the images from Google Cloud Storage on the website with a Content Security Policy (CSP) header. Our storage has a URL https://BUCKET_NAME.storage.googleapis.com/..., so we expected that the following CSP configuration would not block the images from it. But it is still blocked.
CSP: img-src https://BUCKET_NAME.storage.googleapis.com/

After some experiments we figured out that we could unblock images by using a URL template without a bucket name: “https://*.storage.googleapis.com/”. But this rule is not strict enough.

Maybe someone has experience with setting up the correct CSP configuration for the images from the specific bucket. I would be happy for any help.

1 2 889