【发布时间】:2014-08-02 10:46:55
【问题描述】:
我正在(尝试)在 Google Cloud Storage 上托管一个单页应用程序。
应用程序位于 index.html,应用程序使用 Angular 的 html5Mode 处理路由。 (例如:由 index.html 中的 js 应用程序处理的 example.com/this 和 example.com/ 等路由)
使用 Google Cloud Storage 的网站配置,这一切都很好,除了直接访问的路由(“example.com/this”)将 404,因为它们显然没有映射到文件.
我已将我的 404 页面设置为我的索引页面,但为了在 html5Mode 中运行单页应用程序,我真正需要的是此类路由(“example.com/this”)不会返回 404 标头 -它们将简单地由 index.html 处理并返回成功标头 (200)。
这可能吗?
【问题讨论】:
-
我遇到了同样的问题,我可以使用 S3 作为替代方案并使用redirection rules。
标签: html angularjs single-page-application google-cloud-storage pushstate