1
votes

I migrated my website storage to google cloud storage, but the migration/upload was failed for some files because some reasons. By default, if the path/object doesnt exist in the GCS bucket will return XML like below:

<Error>
<Code>NoSuchKey</Code>
<Message>The specified key does not exist.</Message>
<Details>No such object: bucket/the_file.png</Details>
</Error>

Can I change/customize that return to another file/image?

1
Ok, you got an error but do you have the source code to see what happens? Can you also describe your issue? Not sure to catch what help are your looking forguillaume blaquiere
Sorry to make confused, I just want to change the error page(XML) to an image.Muhammad Dyas Yaskur

1 Answers

1
votes

If your static website is online by using a Cloud Storage bucket as is described in this document, you need to upload a public file in your bucket called 404.html, this file must have the html code that you desire to shown when an object doesn't exists.

After uploading the file 404.html it is mandatory to run this command in the cloud shell in order to define the error file

gsutil web set -e 404.html gs://www.example.com

In this page you can find more information about the 404.html file