HTTPS Node.js application on Heroku

前端 未结 1 1097
不知归路
不知归路 2020-12-15 09:41

I have configured my SSL enpoint, and I can confirm that that is working. When I go into my log, I see the following:

Jul 13 08:14:10 support-dash app/web.1:         


        
相关标签:
1条回答
  • 2020-12-15 10:22

    I found the answer here: Heroku Error H13 on ExpressJS Node HTTPS Server

    "SSL termination occurs at Heroku's load balancers; they send your app plain (non-SSL) traffic, so your app should create a non-HTTPS server."

    I then changed my file to:

    var http = require('http');
    var express = require("express");
    
    var app = express();
    
    app.set('port', process.env.PORT || 3000);
    app.use(express.logger());
    
    app.get('/', function(request, response) {
      console.log('[support dash] processing get request')
      response.send('Hello World 2!');
    });
    
    app.listen(process.env.PORT, function () {
      console.log('***** exp listening on port: ' + process.env.PORT);
    });
    

    Everything is working great now over https. Good Luck!

    0 讨论(0)
提交回复
热议问题