最佳答案
                                        
                                                                        
                                我有一个应用程序在 Heroku 上运行,在 Node.js 上运行 Express.js,在 https上运行。如何识别在 Heroku 上使用 Node.js 强制重定向到 https的协议?
我的应用程序只是一个简单的 http服务器,它(还)没有意识到 Heroku 正在向它发送 https请求:
// Heroku provides the port they want you on in this environment variable (hint: it's not 80)
app.listen(process.env.PORT || 3000);
 
                                
                             
                                
                             
                                
                             
                                
                             
                                
                             
                                
                             
                                
                             
                                
                             
                                
                             
                                
                             
                                
                             
                                
                            