Angular AppEngine app.yaml单页应用程序配置

Angular AppEngine app.yaml单页应用程序配置,angular,google-app-engine,single-page-application,app.yaml,Angular,Google App Engine,Single Page Application,App.yaml,我的app.yaml文件有问题-我在AppEngine上有一个带有python运行时的单页应用程序(Angular2应用程序),但是深度链接没有正确路由。这是我的app.yaml文件: runtime: python27 api_version: 1 threadsafe: true skip_files: - ^(.*/)?app\.yaml - ^(.*/)?app\.yml - ^(.*/)?#.*# - ^(.*/)?.*~ - ^(.*/)?.*\.py[co] - ^(.*/)?.

我的app.yaml文件有问题-我在AppEngine上有一个带有python运行时的单页应用程序(Angular2应用程序),但是深度链接没有正确路由。这是我的app.yaml文件:

runtime: python27
api_version: 1
threadsafe: true

skip_files:
- ^(.*/)?app\.yaml
- ^(.*/)?app\.yml
- ^(.*/)?#.*#
- ^(.*/)?.*~
- ^(.*/)?.*\.py[co]
- ^(.*/)?.*/RCS/.*
- ^(.*/)?\..*
- ^(.*/)?tests$
- ^(.*/)?test$
- ^test/(.*/)?
- ^COPYING.LESSER
- ^README\..*
- \.gitignore
- ^\.git/.*
- \.*\.lint$
- ^fabfile\.py
- ^testrunner\.py
- ^grunt\.js
- ^node_modules/(.*/)?
- ^src/(.*/)?
- ^e2e/(.*/)?

handlers:
- url: /
  static_files: dist/index.html
  upload: dist/index.html

- url: /(.*)
  static_files: dist/\1
  upload: dist/(.*)
当直接转到深层链接时,我遇到以下错误:

我假设第二个处理程序就是它所做的,但是如何编写处理程序来将除资产之外的所有内容发送到index.html?这是我的dist目录:


啊,是的,我也有同样的问题。以下是app.yaml,我在Appengine上用于Angular2应用程序:

runtime: python27
api_version: 1
threadsafe: true

handlers:

- url: /api/.*
  script: main.app

# All files that can be compiled in angular. Luckily, they all have suffixes.
- url: /(.*\.(css|eot|gz|html|ico|js|map|png|svg|ttf|woff|woff2))
  static_files: ../client/dist/\1
  upload: ../client/dist/(.*\.(css|eot|gz|html|ico|js|map|png|svg|ttf|woff|woff2))

# Site root, plus anything else, like deep urls
# Make this be secure, otherwise oauth redirect won't work if they want to us with http://
- url: /.*
  static_files: ../client/dist/index.html
  upload: ../client/dist/index.html
  secure: always
  expiration: "15m"

libraries:
- name: webapp2
  version: "2.5.2"

要处理深度链接,您需要在末尾使用一个catch-all规则来始终为index.html提供服务。然而,在此之前,您需要一个映射所有静态内容的规则,我通过添加后缀来实现这一点,但另一种方法是专门命名所有静态资产的文件和目录。

谢谢,您的解决方案节省了我的时间。