我已经向Google Cloud App Engine发布了angular 7应用程序。
索引页面正在加载,但是子目录给了我
Error: Not Found
The requested URL /admin was not found on this server.
Run Code Online (Sandbox Code Playgroud)
这是我的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
Run Code Online (Sandbox Code Playgroud)
编辑:我终于弄清楚了app.yaml中的路由如何为Angular应用程序工作。这是我的工作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: …Run Code Online (Sandbox Code Playgroud) google-app-engine google-cloud-platform google-cloud-sdk angular