为了账号安全,请及时绑定邮箱和手机立即绑定

如何在 Google Cloud AppEngine 上强制使用 https

如何在 Google Cloud AppEngine 上强制使用 https

Go
牛魔王的故事 2023-07-10 17:59:22
我正在尝试对 Google Cloud AppEngine 上托管的应用程序的所有流量强制使用 https。https 可以工作,但尽管遵循将 http 流量重写为 https 的说明,但仍然可以使用 http 访问该站点,这会导致问题。我已将其添加到 app.yaml 中:handlers:   - url: /.*     script: _go_app     secure: always     redirect_http_response_code: 301但似乎没有什么区别。我正在使用 julienschmidt 路由器,然后使用它来处理所有路由:log.Fatal(fmt.Println(http.ListenAndServe(":8080", router)))我已经考虑过使用 http.ListenAndServeTLS 但这需要额外的参数,并且我无法计算出这些值在 Google AppEngine 上下文中应该是什么。log.Fatal(fmt.Println(http.ListenAndServeTLS(":8443", "cert.pem", "key.pem", router)))“cert.pem”和“key.pem”在哪里?我读过,我不需要在我的应用程序中显式提供 TLS,因为 AppEngine 会为我处理它,所以即使我知道参数是什么,我也不确定它是否有助于强制使用https。http://sapling.appspot.comhttps://sapling.appspot.comhttp://sapling.moneyhttps://sapling.money上述所有工作都有效,但我似乎无法将任何一个 http 版本强制为 https。
查看完整描述

目前暂无任何回答

  • 0 回答
  • 0 关注
  • 83 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信