如何修复Google Cloud SSL问题 [英] How to fix google cloud ssl issue

查看:106
本文介绍了如何修复Google Cloud SSL问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为Google App Engine标准环境项目指向了一个新的自定义域,并按照Google的说明编辑了DNS记录,并且该域名似乎已正确重定向.

I pointed a new custom domain to a Google App Engine Standard Environment project and edited the DNS records per Google's instructions, and it seems to be redirected properly.

我去

www.mydomain.com 

凭其应有的激活证书,我仍然会获得

with its supposedly activated certificate, I still get

连接不安全

connection is not secure

在浏览器中

.如果我去

in the browser. If I go to

mydomain.com 

它被重定向到

www.mydomain.com 

具有相同的结果.

但是当我直接输入

https ://www.mydomain.com

它显示网站,并且连接安全.让我知道其原因以及如何解决此问题?

it display the website and with connection is secure. Let me know the reason for this and how to fix this issue?

我在下面的命令中使用了

I used below command

gcloud app domain-mappings list 

,它显示有一个ssl证书ID.但是上述问题仍然存在.

and it displays that there is a ssl certificate id. But the above issue is still there.

推荐答案

此问题的答案取决于您所使用的语言和环境.

The answer to this question depends on which language and which environment you're using.

Node.js和灵活的环境

对于标准环境和灵活环境以及所有语言的灵活环境用户,看来您正在使用Node.js,您需要在应用程序的代码中处理重定向.具体操作方式可能会有所不同,具体取决于您是否使用框架.查看答案,以以Express应用为例.

It looks like you are using Node.js, in the case of Node.js for both standard and flexible environments, and for flexible environment users of all languages, you need to handle the redirect in your application's code. How you do this might change depending on if you're using a Framework. Check out the answer for how to do this with an Express app as an example.

第一代标准环境

对于标准环境Python 2.7,PHP 5.5和Go 1.9,您需要通过更新app.yaml配置文件的处理程序,使App Engine始终使用安全连接处理请求,如下所示:

For the standard environment Python 2.7, PHP 5.5, and Go 1.9, you need to instruct App Engine to always use the secure connection for requests by updating your app.yaml configuration file's handlers to look something like:

handlers:
- url: /.* 
  script: main.app  # <- Python example
  secure: always
  redirect_http_response_code: 301

这篇关于如何修复Google Cloud SSL问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆