1
votes

I have set up a static site to see if hosting a static site on a storage bucket is right for me. "www.pbi-static.org" Setup using the google guides. The domain is a Google Domain. Cname record set to point to "c.storage.googleapis.com".

I have set the website default index.html page and 404.html pages.

The 404 error page works as expected if I try to go to a missing link. However, the index.html page does not work. Instead, I get the error that the xml page is missing style information. Error pasted below.

The metadata for index.html is the same as 404.html. Both have Content-type set to text/html. Both Index.html and 404.html pages are at the root. When I include index.html in the browser url it renders normally. i.e. www.pbi-static.org/index.html.

After reading every article I could find with similar XML error I have tried the following: Disable the Api, wait 10 minutes, and reenable. Delete bucket and recreate, and upload all the files and folders again, make public access, redo the website setting on the bucket to have index.html and 404.html be default again.

I have run out of options after a day of failure so turned here for help.

Here is the XML error I a getting. Any help would be greatly appreciated.

This XML file does not appear to have any style information associated with it. The document tree is shown below.

<Error slick-uniqueid="3">
<div>
<a id="slick_uniqueid"/>
</div>
<Code>MissingSecurityHeader</Code>
<Message>Your request was missing a required header.</Message>
<Details>Authorization</Details>
</Error>
1
Are you adding XML to HTML? What makes you think that's gonna work? Or are you trying to add an SVG/XML to HTML? Or are you trying to do something else? - Jay Gray
I am not adding any XML. Even a simple Hello world Html file had the same error. The code I added was the actual error I am receiving if I do not manually add the index.html in the url when visiting the site. - Chip Edwards

1 Answers

1
votes

The issue was that CORS was not enabled on the bucket.

I tried a get with Postman and it did not get the XML error. After discovering that the site returned perfectly in a Postman Get to www.pbi-static.org, I did some more research and stumbled upon this link: https://cloud.google.com/storage/docs/configuring-cors#gsutil

After following the instructions to create a Json file allowing the Get verb and applying with the gsutil command provided, the issue was resolved.

I hope this helps someone else.