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

How to point my load balancer domain to index.html while hosting in a private gcs bucket

Hi All,

The objective is that I am in need of hosting a static website in a Private GCS bucket. On top of the bucket I'll use load balancer with Cloud Armor policies to restrict access.

I followed this blog https://medium.com/@thetechbytes/private-gcs-bucket-access-through-google-cloud-cdn-430d940ebad9

Created a similar setup in the project. The setup is as given below.

  • A private gcs bucket with the static files
  • A network endpoint group pointing to the GCS buckets domain
  • A Backend service with cloud CDN enabled pointing to the NEG created before
  • Added the HMAC key and secret to the Backend service as mentioned in the blog.
  • Created an external load balancer with the created backend service and added TLS certificate for our own domain

The issue is if I access the URL with it shows loads an XML format page with the list of objects inside the bucket. Only if I mention the path /index.html in the URL it loads to that page. I want to know how to write a LB routing rule to achieve the below.

If someone uses URL example.com it should automatically load as example.com/index.html

1 4 3,493