I've read the Traffic management overview for global external HTTP(S) load balancers URL maps overview but do not see how to do the following:
https://example.com/page ----> https://example.com/page.html
Is it possible to "remove" the .html extension from my URL with Google's global external HTTP(S) load balancer?
My website is hosted on Google Cloud Storage (bucket). I understand that I can use gsutil
to set metadata on files to type:text/html
and that is a viable workaround, however I would need to script that and I spent a couple of hours looking at that but never got it figured out. The script would basically need to recursively list all files with .html
extension then rename them removing the file extension then set the metadata.
URL rewrites allow you to present external users with URLs that are different from the URLs that your services use. Although it says that it provides URL shortening
, extension removal isn't done through the Load Balancer, but rather by setting the file's Content-Type metadata to "text/html" or using App engine or Firebase hosting to serve a static HTML website and hide HTML extension. The latter suggestion was discussed in another stackoverflow post
url: /contact
static_files: www/contact.html
upload: www/contact.html