带有 Google Cloud App Engine 的 Angular html5 模式



我正在Google Cloud(App Engine(上部署我的Angular 7应用程序。

该应用程序运行良好,但我有一些问题...

首先是如何处理 html5 模式,以便当我在路由上(例如 https://myapp.com/my-route/(并且刷新浏览器时,服务器应该回复我的索引.html,并且角度应该执行路由,而不是返回 404 错误页面。

我该怎么做?你可以帮我吗?

非常感谢!

这是我

的app.yaml,它工作正常,如果您有任何提示,请分享:)

runtime: python27
threadsafe: true
skip_files:
- ^(?!dist)
handlers:
- url: /en/(.*.(gif|png|jpg|css|js)(|.map))$
  static_files: dist/en/1
  upload: dist/en/(.*)(|.map)
- url: /it/(.*.(gif|png|jpg|css|js)(|.map))$
  static_files: dist/it/1
  upload: dist/it/(.*)(|.map)
- url: /en/(.*)
  static_files: dist/en/index.html
  upload: dist/en/index.html
- url: /it/(.*)
  static_files: dist/it/index.html
  upload: dist/it/index.html
- url: /
  static_files: dist/en/index.html
  upload: dist/en/index.html
error_handlers:
- file: index.html

最新更新