How to connect imgix to your Google Cloud Storage service

A Google Cloud Storage Source connects to an existing Google Cloud Storage bucket. imgix connects using the credentials you supply, so images don’t have to be public. You will need to turn on Interoperability for your Google Cloud Storage project and create an access key/secret pair to use with imgix.

Setting Cache-Control Headers for Google Cloud Storage

Google Cloud Storage applies Cache-Control: no-store, no-cache, max-age=0, must-revalidate headers in the absence of a Cache-Control header on your image files, disabling any possibility of caching. Because of this, imgix defaults the Cache TTL Behavior mode in Advanced Source Settings for all new Google Cloud Storage Sources to “Enforce minimum”, which applies max-age=1yr, public to all files whether they have a header or not. This is to ensure that caching works on all files.

If you have already set Cache-Control headers on your image files, you should change the Cache TTL Behavior setting to “Respect origin” when you set up your Source. If you have not set headers, we recommend leaving it set to “Enforce minimum”.

Setting Up Your Google Cloud Storage Source

  1. To create the access key and secret, go to the Settings page in your console and click the Interoperability tab.

  2. Choose the project you want to connect to imgix from the dropdown.

  3. Under “Interoperable storage access keys”, click Create a new key.

  4. Go to the Sources page in the imgix dashboard and click the New Source button.

  5. Select Google Cloud Storage from the Source Type dropdown. Screenshot-GCSsource setup

  6. Fill in the details of your Google Cloud Storage project. The parameters are:

    • Access Key: The Interoperable access key for your project.
    • Secret Key: The secret for your project.
    • Bucket Name: The name of the bucket within the project where your images are stored.
    • Path Prefix: (optional) The subfolder prefix you want to resolve to (if it exists). The prefix is prepended to the image path before resolving the image. By default the image path is /.
  7. Name the Subdomain you’d like to use as the base URL for your images.

    Note: The subdomain name you choose is unique to your Source and can’t be re-used. If you’re setting up a Source with a lot of customization (particularly a Custom Domain), choose the name you plan to use going forward.

  8. Click the Save button. Your Source will be queued for deployment. Screenshot-Amazon S3 source setup

Advanced Settings

See the Advanced Source Settings for information about setting up custom domains, defaults, and cache TTL options.


Next: Serving Images