node.js - 如何在nodejs Angular Universal Web应用程序上强制域为https?

标签 node.js google-cloud-platform angular-universal

我有一个在 App Engine 上的 Google Cloud 平台上运行的 Angular Universal 应用,并且我的自定义域指向它。

如何强制我的应用程序在 https 上运行。那么如何强制它从 http 始终使用 https 呢?

我需要在 server.js 入口点文件中添加一些内容吗?

最佳答案

要将您的应用重定向到 https,您可以在 app.yaml 文件中添加以下内容:

runtime: nodejs10

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

关于node.js - 如何在nodejs Angular Universal Web应用程序上强制域为https?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58448577/

相关文章:

node.js - 使用jade从文件中读取数据并传递到模板

node.js - 如何将 GraphQL 连接到 MySQL

javascript - Node 'readline' 模块没有 'end' 事件 - 当没有更多行时我该怎么做?

email - 如何启用应用程序从谷歌容器引擎发送电子邮件

angular - 将 angular-universal 部署到 apache 服务器(Angular 9)

angular - 引用错误 : Zone is not defined

Angular 通用和外部 API

javascript - 脚本中的阻塞 Node

google-cloud-platform - 谷歌云功能 : missing main. py

google-cloud-platform - Google Cloud Serverless VPC 何时在欧洲推出?