How to fix google cloud ssl issue

2019-06-12 02:57发布

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.

When I go to

www.mydomain.com 

with its supposedly activated certificate, I still get

connection is not secure

in the browser. If I go to

mydomain.com 

it gets redirected to

www.mydomain.com 

with the same result.

But when I directly enter

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 

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

1条回答
爷的心禁止访问
2楼-- · 2019-06-12 03:38

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

Node.js and flexible environment

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.

First generation standard environment

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
查看更多
登录 后发表回答