I configured load balancing and CDN for storage static web pages in Google Cloud, and configured domain name access in load balancing. When I access the domain name in the browser, the domain name suffix always displays "index.html", but I don't want to If you want this suffix, how do you configure it not to display this suffix when you visit in the browser.
Asked
Active
Viewed 1,867 times
1
-
Are you saying you do not want to display the suffix which is `.html` or the entire file `index.html`. You cannot accomplish the first and Cloud Storage is not causing the second. What is the displayed URL when you enter the URL without `index.html`? If you enter `www.example.com/` Google Cloud Storage will return the content of `index.html` but does not redirect your browser to `www.example.com/index.html`. There is something else going on in your browser setup. – John Hanley Feb 06 '21 at 07:07
1 Answers
2
The index.html
suffix appearing in your URL is not a condition of Cloud Load Balancer nor the Cloud CDN. It is a condition presented by your Web Server.
The LB just redirects the request towards the backend services.
I recommend you check this other thread discussions here how-to-remove-html-from-url, as it depends of your Web Server application.
For file hosted in a storage bucket, you can control the action by set the MainPageSuffix
value like:
gsutil web set -m index.html -e 404.html gs://www.example.com
More info and documentation here: gsutil commands and tips for buckets as webserver

W.Andre
- 101
- 4
-
A web server is not present/involved for Google Cloud Storage static websites. – John Hanley Feb 06 '21 at 07:08
-
For file hosted in a storage bucket, you can control the action by set the `MainPageSuffix`value like: `gsutil web set -m index.html -e 404.html gs://www.example.com` More info and documentation here: [gsutil commands](https://cloud.google.com/storage/docs/gsutil/commands/web) [tips for buckets as webserver](https://cloud.google.com/storage/docs/static-website#tips) – W.Andre Feb 07 '21 at 14:34
-
1Those command only set which page to display (default, 404, etc). They do not affect how a URL is displayed in a user's browser. – John Hanley Feb 07 '21 at 18:48