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.
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.
I have not used backend buckets here. I only have private GCS bucket. I can’t make it public. And so I didn’t go with Backend buckets. I created a NEG and mapped everything as mentioned in the post. If backend buckets can be private please let me know I’ll also try that setup. But the current setup is working for me. The only thing is I want to acheive the below.
Replying here in case it helps someone in the future. I had the same issue and I was able to solve it by inserting a pathRule with a urlRedirect, which redirects from the path / to the pathRedirect /index.html.