在Google云端存储桶上部署angular2 Web应用

时间:2016-06-27 11:44:42

标签: javascript angular google-cloud-platform

因此,要部署angular2应用程序,我们只需按照here. (deploy static website)所述将所有生产文件上传到存储桶。

但是我们如何将所有网址重定向到index.html,以便angular2路由器可以处理它们。我们可以从Main Page桶中设置website configuration。但我们无法指定所有网址都应重定向到index.html

目前除Main Page以外的任何网址都会导致找不到404页面。

similar question on SO for amazon S3,但找不到谷歌云。

1 个答案:

答案 0 :(得分:6)

我通过使用hack解决了这个问题,不知道正确的方法是什么。但至少这有效。

  1. console.cloud.google.com中打开存储空间。 enter image description here

  2. 点击在水桶列表中修改网站配置。点击最右边的三个点。然后选择edit configuratione enter image description here

  3. 输入与404页面相同的主页面。角度路由将以这种方式正常工作。 enter image description here