【发布时间】:2016-09-03 22:55:12
【问题描述】:
我正在尝试制作一个在 App Engine 标准环境上运行的 Angular 2 应用。在应用内导航时,它适用于以下app.yaml 配置:
handlers:
- url: /api/.*
script: _go_app
- url: (.*)/
static_files: static\1/index.html
upload: static
- url: (.*)
static_files: static\1
upload: static
我可以点击从/ 到/clients 或/clients/234234 的链接,它工作正常。
但是,如果我在非基本路径中刷新浏览器,例如http://myapp.appspot.com/clients/234234 然后我收到 404 错误。我想我需要从所有路径为我的index.html 提供服务,这就是我认为(.*)/ 和(.*) 会做的事情。
如何设置我的处理程序/应用程序,以便我可以使用 HTML5 路由而不让这种情况发生?
【问题讨论】: