【问题标题】:AppEngine Nodejs not redirecting HTTP to HTTPSAppEngine Nodejs 未将 HTTP 重定向到 HTTPS
【发布时间】:2021-01-01 16:38:26
【问题描述】:

我已经像这样设置了我的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/\1
    upload: dist/(.*\..+)$
    # catch all handler to index.html
  - url: /.*
    static_files: dist/index.html
    upload: dist/index.html

这适用于 Flask 项目,但对于我的 Nodejs 项目,它似乎不起作用。我需要将script: auto 更改为其他内容吗?

【问题讨论】:

    标签: node.js google-app-engine yaml


    【解决方案1】:

    您需要将secure: always 添加到每个需要的handler that this behavior。请注意,您有两个具有相同- url: /.* 的处理程序。该网址的最后一个定义没有secure 参数。

    【讨论】:

      猜你喜欢
      • 2019-03-24
      • 1970-01-01
      • 2015-04-05
      • 1970-01-01
      • 2017-11-13
      • 1970-01-01
      • 1970-01-01
      • 2019-06-25
      • 2011-11-03
      相关资源
      最近更新 更多