Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

I can find various references to SSL support in the Cloud Foundry forums, but no actual examples of HTTPS apps. 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.

like image 744
Ryan Shaw Avatar asked Aug 31 '11 21:08

Ryan Shaw


2 Answers

The SSL connection will terminate at the loadbalancer and then forward the unencrypted HTTP connection to your node app.

Just use https://your-app.cloudfoundry.com instead of http://...

like image 58
Martin Avatar answered Sep 18 '22 15:09

Martin


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). 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.

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.

So if you are using node.js core modules, use the http, not https module.

like image 28
JellicleCat Avatar answered Sep 17 '22 15:09

JellicleCat