简体   繁体   English

如何在nodejs Angular Universal web应用程序上强制域到https?

[英]How to force domain to https on nodejs Angular Universal web app?

I have an Angular Universal app running on the Google Cloud platform on App Engine and I have my custom domain pointed to it.我有一个 Angular 通用应用程序在 App Engine 上的 Google Cloud 平台上运行,并且我的自定义域指向它。

How do I force my app to run on https.如何强制我的应用在 https 上运行。 So how to do I force it from http to use https always?那么我该如何强制它从 http 始终使用 https 呢?

Is it something I need to add in my server.js entrypoint file?我需要在 server.js 入口点文件中添加什么吗?

To redirect your app to https, you can add the following in your app.yaml file:要将您的应用重定向到 https,您可以在 app.yaml 文件中添加以下内容:

runtime: nodejs10

handlers:
- url: /.*
  secure: always
  redirect_http_response_code: 301
  script: auto

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM