GCP Error: 301: Moved Permanently error, while trying to access a directory path on google cloud storage.

0 votes
Accessing a directory path returns an empty object and a 301 HTTP response code.
Oct 9 in GCP by Sam
• 4,330 points
40 views

1 answer to this question.

0 votes

If your browser downloads a zero byte object and you get a 301 HTTP response code when accessing a directory, such as http://www.example.com/dir/, your bucket most likely contains an empty object of that name. 

To check that this is the case and fix the issue:

  1. Open the Cloud Storage browser in the Google Cloud Platform Console.

  2. Click the Activate Cloud Shell button at the top of the Google Cloud Platform Console. 

  3. Run gsutil ls -R gs://www.example.com/dir/. If the output includes http://www.example.com/dir/, you have an empty object at that location.

  4. Remove the empty object with the command: gsutil rm gs://www.example.com/dir/

You can now access http://www.example.com/dir/  and have it return that directory's index.html file instead of the empty object.

answered Oct 9 by Sirajul
• 40,990 points

Related Questions In GCP

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

GCP Error: 403: Access Denied

Check that your credentials are correct. For ...READ MORE

answered Oct 9 in GCP by Sirajul
• 40,990 points
33 views
0 votes
1 answer

Permissions issue with Google Cloud Storage Bucket.

You can regain access to the object by assigning an applicable role, like roles/storage.objectAdmin, to ...READ MORE

answered Oct 10 in GCP by Sirajul
• 40,990 points
97 views
0 votes
1 answer
0 votes
1 answer

How to create a Google Cloud Filestore instance?

Create an instance by running the instances create command, ...READ MORE

answered Oct 23 in GCP by Sirajul
• 40,990 points
27 views