AppEngine Nodejs 不将 HTTP 重定向到 HTTPS
AppEngine Nodejs not redirecting HTTP to HTTPS
我已经像这样设置了我的 app.yaml
文件:
runtime: nodejs10
handlers:
- url: /.*
script: auto
secure: always
redirect_http_response_code: 301
# Serve all static files with urls ending with a file extension
- url: /(.*\..+)$
static_files: dist/
upload: dist/(.*\..+)$
# catch all handler to index.html
- url: /.*
static_files: dist/index.html
upload: dist/index.html
这对 Flask 项目有效,但对我的 Nodejs 项目似乎不起作用。我需要将 script: auto
更改为其他内容吗?
您需要为每个 handler that this behavior 添加 secure: always
。请注意,您有两个具有相同 - url: /.*
的处理程序。 url 的最后一个定义没有 secure
参数。
我已经像这样设置了我的 app.yaml
文件:
runtime: nodejs10
handlers:
- url: /.*
script: auto
secure: always
redirect_http_response_code: 301
# Serve all static files with urls ending with a file extension
- url: /(.*\..+)$
static_files: dist/
upload: dist/(.*\..+)$
# catch all handler to index.html
- url: /.*
static_files: dist/index.html
upload: dist/index.html
这对 Flask 项目有效,但对我的 Nodejs 项目似乎不起作用。我需要将 script: auto
更改为其他内容吗?
您需要为每个 handler that this behavior 添加 secure: always
。请注意,您有两个具有相同 - url: /.*
的处理程序。 url 的最后一个定义没有 secure
参数。