Angular 7 Routing в Google Cloud App Engine не работает - PullRequest
2 голосов
/ 26 апреля 2019

Я опубликовал угловое приложение 7 для Google Cloud App Engine.

Страница индекса загружается, но подкаталоги дают мне

Error: Not Found
The requested URL /admin was not found on this server.

Это мой app.yaml:

runtime: nodejs10


env_variables:
environment: "--prod"

handlers:

  - url: /
    static_files: dist/XXX/index.html
    upload: dist/XXX/index.html
  - url: /
    static_dir: dist/XXX/
  - url: /.*
    secure: always
    script: auto

Редактировать: Я наконец понял, как работает маршрутизация в app.yaml для Angular Applications.Вот мой рабочий app.yaml:

runtime: nodejs10

env_variables:
  environment: "--prod"

handlers:

- url: /
  secure: always
  static_files: dist/index.html
  upload: dist/.*
- url: /(.*\.js)
  secure: always
  redirect_http_response_code: 301
  static_files: dist/\1
  upload: dist/.*\.js
- url: /(.*\.css)
  secure: always
  redirect_http_response_code: 301
  static_files: dist/\1
  mime_type: text/css
  upload: dist/.*\.css
- url: /.*
  secure: always
  static_files: dist/index.html
  upload: dist/.*
...