[英]HTTPS node app on Cloud Foundry
Is it possible to deploy a node.js app on Cloud Foundry that listens for HTTPS requests on port 443? 是否可以在Cloud Foundry上部署侦听端口443上的HTTPS请求的node.js应用程序?
I can find various references to SSL support in the Cloud Foundry forums, but no actual examples of HTTPS apps. 我可以在Cloud Foundry论坛中找到各种对SSL支持的引用,但没有HTTPS应用程序的实际示例。 The article " Setup SSL on cloudfoundry landscape " seems to indicate that I need to install nginx and use that, but there is not really enough information there to tell me what I need to do. 文章“ 在cloudfoundry landscape上设置SSL ”似乎表明我需要安装nginx并使用它,但是没有足够的信息告诉我我需要做什么。
The SSL connection will terminate at the loadbalancer and then forward the unencrypted HTTP connection to your node app. SSL连接将在负载均衡器处终止,然后将未加密的HTTP连接转发到您的节点应用程序。
Just use https://your-app.cloudfoundry.com instead of http://... 只需使用https://your-app.cloudfoundry.com而不是http:// ...
You don't need nginx in particular, but you do need something capable of listening to a port (which Cloud Foundry will assign at the moment, indicated by the environment variable PORT
or, for older versions of Cloud Foundry, VCAP_APP_PORT
). 您根本不需要nginx ,但是您确实需要能够侦听端口的东西(Cloud Foundry目前将分配,由环境变量PORT
指示,或者对于旧版本的Cloud Foundry, VCAP_APP_PORT
)。 So nginx will work for this purpose, but if you have made a node.js app, the core module http (optionally paired with express ) would be a more natural choice of webserver. 所以nginx 可以用于此目的,但是如果你创建了一个node.js应用程序,那么核心模块http (可选择与express配对)将是webserver的更自然的选择。
Now if your app requires ssl, you'd think that you'd need to configure your webserver (nginx, express, etc.) for HTTPS, but you do not need to do so because Cloud Foundry handles the SSL and passes the decrypted HTTP to your webserver . 现在,如果您的应用需要ssl,您认为您需要为HTTPS配置您的网络服务器(nginx,express等),但您不需要这样做,因为Cloud Foundry处理SSL并传递解密的HTTP到你的网络服务器 。
So if you are using node.js core modules, use the http
, not https
module. 因此,如果您使用的是node.js核心模块,请使用http
,而不是https
模块。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.