Search code examples
google-app-enginegoogle-cloud-platformgoogle-cloud-storagecdn

Google Cloud Platform Storage error: "Locked Domain Expired" when trying to access my storage items


I am currently hosting some static .css, .js, .tff, and image resources for my site in the google cloud platform storage buckets. I am able to access these resources for up to approximately 20 minutes after uploading them. After about 20 or so minutes I get a 401 error message when I try to access them that says:

{"error":{"errors":[{"domain":"global","reason":"lockedDomainExpired","message":"Locked Domain Expired"}],"code":401,"message":"Locked Domain Expired"}}

From the GCP site:

lockedDomainExpired: When downloading content from a cookie-authenticated site, e.g., using the Storage Browser, the response will redirect to a temporary domain. This error will occur if access to said domain occurs after the domain expires. Issue the original request again, and receive a new redirect.

I'm not really sure what this means in the context of how I'm trying to use GCP storage buckets? Any help or resources would be greatly appreciated.


Solution

  • When you click on a link to an object in the developer console it generates a URL that is only valid for a short period of time. I suspect you are copying this URL into your site rather than using the publicly accessible URL.

    Assuming the objects are publicly readable you should be able to use this URL format instead.

    https://storage.googleapis.com/<bucket>/<object>