Google Cloud Angular App Hosting 401 Error on Hosting

192 views
Skip to first unread message

Rakshit Patel

unread,
Mar 27, 2020, 2:45:13 PM3/27/20
to Angular and AngularJS discussion

I'm trying to deploy an angular app to a Google Cloud Storage bucket so that I can serve the app from there. The bucket has has public access and is named so that I can serve it as a custom website via CNAME (let's say test.example.com). The bucket is also configured to map the main page to index.html and the 404 handler to index.html. When loading https://test.example.com, most of the app loads fine, but any of the assets that are loaded via XHR (GET from /assets/) get a HTTP 401 error. There are no preflight requests. I've tried setting various permutations of CORS settings on the bucket, but nothing seems to help.

I am getting this on loading on assets.

<?xml version='1.0' encoding='UTF-8'?><Error><Code>AuthenticationRequired</Code><Message>Authentication required.</Message></Error>

Can anyone help me out.

We are using Google storage and Google DNS Hosting for this.

Below link is for reference: https://html.developreference.com/article/10228923/401+error+with+Angular+app+deployed+to+Google+Cloud+Storage+with+CNAME%27d+DNS

Sander Elias

unread,
Apr 1, 2020, 12:45:21 AM4/1/20
to Angular and AngularJS discussion
Hi Rakshit

A 401 is a permissions error has nothing to do with CORS. Are you sure you did set the right permissions to the assets folder? The Access folder should have public read and list permissions.

Regards
Sander
Reply all
Reply to author
Forward
0 new messages