google-app-engine - 如何使用自定义域强制执行到 Google App Engine 的 HTTPS 流量?

标签 google-app-engine ssl google-domains

我在 Google Domains (www.example.com) 上有一个网站,它由 Gcloud 托管。我按照此处列出的说明设置 SSL 和 https:https://cloud.google.com/appengine/docs/standard/python/securing-custom-domains-with-ssl

基本上,我只是运行了 gcloud beta app domain-mappings update example.com --certificate-management='AUTOMATIC'

现在我确实可以访问https://example.com了和 https://www.example.com .但我也可以访问这些域的不安全 http 版本。

如何将我的 Google 域设置为始终使用 https?如果有人输入 http://example.com ,我希望它转到 https 站点。

记录: 我的裸域 (example.com) 有 4 条 A 记录和 4 条 AAAA 记录。

我的 www.example.com 域有 1 条别名=www 的 CNAME 记录。

最佳答案

您是否尝试过在 app.yaml 的处理程序中设置 secure: always

handlers:
- url: /youraccount/.*
  script: accounts.app
  login: required
  secure: always

always

Requests for a URL that match this handler that do not use HTTPS are automatically redirected to the HTTPS URL with the same path. Query parameters are preserved for the redirect

https://cloud.google.com/appengine/docs/standard/python/config/appref#handlers_element

关于google-app-engine - 如何使用自定义域强制执行到 Google App Engine 的 HTTPS 流量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48752601/

相关文章:

ssl - artifactory pro registry docker 镜像

amazon-web-services - AWS SSL 证书未在整个站点传播

dns - 如何在 Google Domain 中将裸域重定向到 www?

amazon-web-services - 使用在 Google Domains 上注册的域指向 Amazon S3 静态网站

python - 谷歌应用引擎 : how can I programmatically access the properties of my Model class?

javascript - 谷歌应用引擎中 channel api中的 channel 断开通知

google-app-engine - 无法解决 Dart App Engine 依赖性

google-app-engine - 无法使用 appengine/log 找到日志

ruby-on-rails - rails 4 : Rack SSL enforcer ERR_SSL_PROTOCOL_ERROR with localhost

heroku - 带有 Heroku 和 Google Domains 的 DNS - SSL 转发